Lab 2: PostgreSQL sessions and recovery experiment
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
FROM python:3.12.7-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
APP_HOST=0.0.0.0 \
|
||||
APP_PORT=8080 \
|
||||
DATABASE_URL=postgresql://messenger:messenger@postgres:5432/messenger \
|
||||
REDIS_URL=redis://redis:6379/0 \
|
||||
SESSION_STORE=redis
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN groupadd --system app && useradd --system --gid app --home /app app
|
||||
|
||||
COPY requirements.txt ./requirements.txt
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY app.py ./app.py
|
||||
COPY src ./src
|
||||
COPY migrations ./migrations
|
||||
COPY scripts ./scripts
|
||||
|
||||
RUN chown -R app:app /app
|
||||
USER app
|
||||
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=5 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=3)"
|
||||
|
||||
CMD ["python", "app.py"]
|
||||
Reference in New Issue
Block a user