1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-21 15:14:19 +00:00

Dockerize because why not

This commit is contained in:
Steffo 2024-05-21 02:32:54 +02:00
parent 26a5302346
commit bcefaed447
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 16 additions and 2 deletions

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./server.py" ]
LABEL org.opencontainers.image.title="estus"
LABEL org.opencontainers.image.description="Software inventario per il CED dell'Unione Terre di Castelli"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.url="https://github.com/Steffo99/estus"
LABEL org.opencontainers.image.authors="Stefano Pigozzi <me@steffo.eu>, Lorenzo Balugani <lorenzo.balugani@gmail.com>"

View file

@ -14,7 +14,7 @@ app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True app.jinja_env.lstrip_blocks = True
# SQL # SQL
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data/db.sqlite'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app) db = SQLAlchemy(app)
@ -1023,7 +1023,7 @@ def inject_vars():
if __name__ == "__main__": if __name__ == "__main__":
# Se non esiste il database, crealo e inizializzalo! # Se non esiste il database, crealo e inizializzalo!
if not os.path.isfile("db.sqlite"): if not os.path.isfile("data/db.sqlite"):
with app.app_context(): with app.app_context():
db.create_all() db.create_all()
try: try: