Skip to content

Instantly share code, notes, and snippets.

@Lauriy
Last active July 29, 2024 20:32
Show Gist options
  • Save Lauriy/1141199542ad0abb128fb5cdada27f7a to your computer and use it in GitHub Desktop.
Save Lauriy/1141199542ad0abb128fb5cdada27f7a to your computer and use it in GitHub Desktop.
Django Dockerfile base layer
FROM python:3.12-slim AS base
LABEL maintainer="Lauri Elias <[email protected]>"
# So we'd never have a stuck build waiting for input
ARG DEBIAN_FRONTEND=noninteractive
# Waste of microseconds, I trust the base image to be up to date
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
# So the very last log entry before a crash would be recorded
ENV PYTHONUNBUFFERED=1
# To avoid writing .pyc files which may interfere during development
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /home/docker/rik_proovitöö
COPY manage.py requirements.txt ./
# Buildkit style cache mount to speed up repeated builds
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt && rm -rf requirements.txt
COPY docker-entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/docker-entrypoint.sh
# We put defaults we don't want to repeat and rarely changed files into this stage
ENTRYPOINT ["docker-entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment