lab4: s3 attachments, private bucket, healthchecks, tests and report
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
# Pinned base image. Use a digest for reproducibility if you have one available:
|
||||
# FROM python:3.12.7-slim-bookworm@sha256:<digest>
|
||||
FROM python:3.12.7-slim-bookworm
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
APP_HOST=0.0.0.0 \
|
||||
APP_PORT=8080
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY src/ ./src/
|
||||
|
||||
RUN useradd --create-home --uid 10001 --shell /usr/sbin/nologin appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=2s --timeout=3s --start-period=5s --retries=2 \
|
||||
CMD python -c "import sys,urllib.request; \
|
||||
sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=2).status==200 else 1)"
|
||||
|
||||
CMD ["python", "-m", "src"]
|
||||
Reference in New Issue
Block a user