Commit 91a1ee9f authored by Lukas Böhm's avatar Lukas Böhm
Browse files

docker volume

data now remains persistent even if container is not running
parent 6579b11e
FROM python:3.8-alpine
WORKDIR /home/chiefsend
WORKDIR /chiefsend
COPY ./requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
......@@ -18,5 +18,5 @@ ENV FLASK_APP chiefsend.py
EXPOSE 5000
ENTRYPOINT gunicorn -b :5000 --access-logfile - --error-logfile - chiefsend:app
ENTRYPOINT gunicorn -b :5000 --access-logfile - --error-logfile - chiefsend:app
\ No newline at end of file
......@@ -2,7 +2,21 @@
Eine Tolle Webapp zum Austausch von Dateien
## Installation
`git clone https://gitlab.cs.fau.de/ib49uquh/chiefsend.git`
`cd chiefsend`
`docker volume create chiefsend-vol`
`docker build -t chiefsend:latest .`
`docker run --name chiefsend-test -d -p 8000:5000 --rm chiefsend:latest`
\ No newline at end of file
`docker run --name chiefsend-test -d -p 8000:5000 --mount source=chiefsend-vol,target=/chiefsend --rm chiefsend:latest`
## Removing
`docker container stop chiefsend-test`
`docker container rm chiefsend-test`
`docker volume rm chiefsend-vol`
......@@ -2,7 +2,9 @@ import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
print('WE GOIN IN BOIS')
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
print(basedir)
app = Flask(__name__)
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') or 'jonas ist ein kek'
......
......@@ -27,6 +27,7 @@ def remove_share(sh):
def remove_expired():
print('cleaning up!')
with app.app_context():
expired_shares = Share.query.filter(datetime.now() > Share.expires).all()
for sh in expired_shares:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment