Lägg till stöd för docker

This commit is contained in:
jwradhe 2025-12-16 20:33:01 +01:00
parent 2f099575fd
commit d125efebb0
3 changed files with 23 additions and 1 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
__pycache__/
*.pyc
.pytest_cache/
venv/
.git/
.DS_Store
todo.db

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app
EXPOSE 5001
CMD ["python", "app.py"]

3
app.py
View File

@ -160,4 +160,5 @@ def create_app(test_config: dict | None = None) -> Flask:
if __name__ == "__main__":
app = create_app()
app.run(host="127.0.0.1", port=5001, debug=True)
debug = os.environ.get("FLASK_DEBUG", "0") == "1"
app.run(host="0.0.0.0", port=5001, debug=debug)