forked from mtusi2026/mtusi2026lab2
Messages survive restart in Postgres, and bearer sessions persist in Valkey with AOF. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
770 B
Docker
30 lines
770 B
Docker
# syntax=docker/dockerfile:1.7
|
|
FROM python:3.12.6-slim-bookworm
|
|
|
|
RUN groupadd --system --gid 10001 app \
|
|
&& useradd --system --uid 10001 --gid app --no-create-home app
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt /app/requirements.txt
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
COPY --chown=app:app src/ /app/
|
|
COPY --chown=app:app migrations/ /app/migrations/
|
|
|
|
USER app
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
APP_HOST=0.0.0.0 \
|
|
APP_PORT=8080 \
|
|
APP_ENV=lab
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=5 \
|
|
CMD python3 -c "import urllib.request,sys; \
|
|
urllib.request.urlopen('http://127.0.0.1:8080/health/live',timeout=2); \
|
|
sys.exit(0)" || exit 1
|
|
|
|
CMD ["python3", "/app/server.py"]
|