# Build an intermediate image for the Python requirements FROM python:3.9-slim-buster as intermediate # Install Git and Python requirements RUN apt update && apt install -y build-essential COPY requirements.txt . RUN python -m pip install --user -r requirements.txt # Start from a fresh image FROM python:3.9-slim-buster # Keeps Python from generating .pyc files in the container ENV PYTHONDONTWRITEBYTECODE=1 # Turns off buffering for easier container logging ENV PYTHONUNBUFFERED=1 RUN useradd -u 4000 -d /app appuser WORKDIR /app # Copy over the Python requirements from the intermediate container COPY --from=intermediate /root/.local /app/.local RUN chown -R appuser: /app USER appuser # Set the main execution command ENTRYPOINT [".local/bin/waitress-serve", "main:app"] # HEALTHCHECK --interval=5s --timeout=30s --start-period=5s --retries=3 CMD [ "/app/healthcheck.sh" ] EXPOSE 8080/tcp # Copy in the code COPY slinky slinky/ COPY templates templates/ COPY config.yaml . COPY main.py .