forked from mtusi2026/mtusi2026lab2
finished
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
FROM python:3.12.8-slim-bookworm
|
||||
|
||||
RUN useradd --create-home --uid 10001 --shell /usr/sbin/nologin appuser \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
COPY src/app /app/app
|
||||
COPY migrations /app/migrations
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONPATH=/app
|
||||
|
||||
USER appuser
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=12 \
|
||||
CMD curl -fsS http://127.0.0.1:8080/health/ready || exit 1
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
Reference in New Issue
Block a user