forked from mtusi2026/mtusi2026lab4
18 lines
1.2 KiB
Docker
18 lines
1.2 KiB
Docker
FROM python:3.12.8-slim-bookworm@sha256:2199a62885a12290dc9c5be3ca0681d367576ab7bf037da120e564723292a2f0
|
|
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_DEFAULT_TIMEOUT=60 PIP_RETRIES=3
|
|
WORKDIR /app
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt && groupadd --gid 10001 app && useradd --uid 10001 --gid app --no-create-home --shell /usr/sbin/nologin app
|
|
COPY --chown=app:app server.py ./server.py
|
|
COPY --chown=app:app migrations ./migrations
|
|
COPY --chown=app:app scripts/reconcile.py ./scripts/reconcile.py
|
|
COPY --chown=app:app tests/reconcile_scenarios.py ./tests/reconcile_scenarios.py
|
|
COPY --chown=app:app tests/private_bucket_check.py ./tests/private_bucket_check.py
|
|
COPY --chown=app:app tests/reconcile_unit.py ./tests/reconcile_unit.py
|
|
COPY --chown=app:app tests/s3_failure_probe.py ./tests/s3_failure_probe.py
|
|
COPY --chown=app:app tests/fixtures/sample.png ./tests/fixtures/sample.png
|
|
USER 10001:10001
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=5 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
|
CMD ["python", "server.py"]
|