Implement lab2 PostgreSQL sessions and Redis cache
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
FROM python:3.12.10-slim-bookworm
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN addgroup --system appgroup \
|
||||
&& adduser --system --ingroup appgroup --no-create-home appuser \
|
||||
&& chown appuser:appgroup /app
|
||||
|
||||
COPY --chown=appuser:appgroup app ./app
|
||||
COPY --chown=appuser:appgroup migrations ./migrations
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2).read()" || exit 1
|
||||
|
||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--no-access-log"]
|
||||
Reference in New Issue
Block a user