diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..31c0fc4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git +.github +**/__pycache__ +**/*.pyc +**/*.pyo +**/*.pyd +**/.pytest_cache +**/.mypy_cache +**/.DS_Store + +# Frontend and docs are not needed for backend image +parental-control-system/frontend/node_modules +parental-control-system/frontend/build +skills diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..07ade99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.12-slim + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +WORKDIR /app + +COPY parental-control-system/backend/requirements.txt ./requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +COPY parental-control-system/backend/ ./ + +RUN useradd --create-home --shell /usr/sbin/nologin appuser \ + && chown -R appuser:appuser /app +USER appuser + +EXPOSE 5000 + +CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-5000} main:app --workers 2 --threads 4 --timeout 60"]