Skip to content

Instantly share code, notes, and snippets.

@dkarchmer
Created July 28, 2024 23:13
Show Gist options
  • Save dkarchmer/e5dbaf9e1b09973838a7074006b8d0d5 to your computer and use it in GitHub Desktop.
Save dkarchmer/e5dbaf9e1b09973838a7074006b8d0d5 to your computer and use it in GitHub Desktop.
Dockerfile for Python with PDM
FROM python:3.12-slim as production
ENV DEBIAN_FRONTEND="noninteractive"
SHELL ["/bin/bash", "-c"]
WORKDIR /app
RUN set -eux; \
apt-get update && \
apt-get install --no-install-recommends -y mime-support git curl libcurl4-openssl-dev \
libssl-dev make g++ procps tzdata xmlsec1 node-typescript gettext
ENV PATH="/root/.local/bin:$PATH"
RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -
COPY pyproject.toml pdm.lock /app/
RUN pdm config python.use_venv false
RUN pdm sync --prod --global -p .
RUN apt-get remove --purge -y git libcurl4-openssl-dev libssl-dev make g++ && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
COPY . /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment