forked from mtusi2026/mtusi2026lab3
feat-(lab3 started, X-Instance-ID, Idempotence-Key in send_message method added)
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
FROM python:3.13-slim AS Builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN python -m venv /opt/venv
|
||||
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=Builder /opt/venv /opt/venv
|
||||
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN groupadd -r appuser && useradd -r -g appuser -d /app -s /sbin/nologin appuser
|
||||
|
||||
COPY src/ ./src/
|
||||
|
||||
COPY scripts/ ./scripts/
|
||||
|
||||
RUN chown -R appuser:appuser /app
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/live')" || exit 1
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
CMD ["python", "-m", "uvicorn", "src.main:application", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"]
|
||||
Reference in New Issue
Block a user