forked from mtusi2026/mtusi2026lab3
lab2
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
FROM python:3.11.7-slim-bookworm AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
FROM python:3.11.7-slim-bookworm AS runner
|
||||
|
||||
RUN useradd -u 10001 -m appuser
|
||||
WORKDIR /home/appuser
|
||||
|
||||
COPY --from=builder /install /usr/local
|
||||
COPY app.py .
|
||||
|
||||
USER appuser
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')"
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
Reference in New Issue
Block a user