forked from mtusi2026/mtusi2026lab5
30 lines
859 B
Docker
30 lines
859 B
Docker
FROM python:3.14.8-slim-bookworm
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
APP_HOST=0.0.0.0 \
|
|
APP_PORT=8080 \
|
|
APP_ENV=lab
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt ./
|
|
RUN python -m pip install --no-cache-dir -r requirements.txt
|
|
RUN groupadd --gid 10001 appuser \
|
|
&& useradd --uid 10001 --gid appuser --no-create-home --shell /usr/sbin/nologin appuser
|
|
|
|
COPY src ./src
|
|
COPY migrations ./migrations
|
|
COPY tests ./tests
|
|
COPY student-tests ./student-tests
|
|
COPY scripts ./scripts
|
|
COPY contracts ./contracts
|
|
COPY lab.json ./
|
|
|
|
USER 10001:10001
|
|
EXPOSE 8080
|
|
STOPSIGNAL SIGTERM
|
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD ["python", "-c", "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:'+os.getenv('APP_PORT','8080')+'/health/ready', timeout=2).close()"]
|
|
|
|
CMD ["python", "-m", "src.run"]
|