forked from mtusi2026/mtusi2026lab4
26 lines
633 B
Docker
26 lines
633 B
Docker
FROM python:3.12.7-slim
|
|
|
|
WORKDIR /app
|
|
|
|
ENV APP_HOST=0.0.0.0 \
|
|
APP_PORT=8080 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
RUN groupadd --system app && useradd --system --gid app --create-home --home-dir /home/app app
|
|
|
|
COPY requirements.txt /app/requirements.txt
|
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
|
|
COPY . /app
|
|
RUN chown -R app:app /app
|
|
|
|
USER app
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/live', timeout=2).read()" || exit 1
|
|
|
|
CMD ["python3", "src/server.py"]
|