Add Docker support with Gunicorn, SQLite volume persistence, and optional PostgreSQL

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Shayan Azadi
2026-07-01 00:32:25 +03:30
parent 066276743a
commit 5dd29c41d6
8 changed files with 151 additions and 3 deletions

36
Dockerfile Normal file
View File

@@ -0,0 +1,36 @@
# FunZone Accounting Backend Dockerfile
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
build-essential \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/
RUN mkdir -p /data \
&& adduser --disabled-password --gecos '' appuser \
&& chown -R appuser:appuser /app /data \
&& chmod +x /app/docker-entrypoint.sh
USER appuser
EXPOSE 8010
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:8010/health || exit 1
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8010", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-"]