File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 1- FROM python:3.12 AS builder
1+ ARG POETRY_VERSION=1.8.3
2+ ARG PYTHON_VERSION=3.12
23
3- # --- Install Poetry ---
4- ARG POETRY_VERSION=1.8
4+ FROM weastur/poetry:${POETRY_VERSION}-python-${PYTHON_VERSION} AS builder
55
66ENV POETRY_HOME=/opt/poetry
77ENV POETRY_NO_INTERACTION=1
@@ -12,7 +12,16 @@ ENV PYTHONUNBUFFERED=1
1212# Tell Poetry where to place its cache and virtual environment
1313ENV POETRY_CACHE_DIR=/opt/.cache
1414
15- RUN pip install "poetry==${POETRY_VERSION}"
15+ # Install build-time deps for poetry and FFI
16+ RUN apt-get update \
17+ && apt-get install -y --no-install-recommends \
18+ build-essential \
19+ g++ \
20+ gcc \
21+ libffi-dev \
22+ libssl-dev \
23+ pkg-config \
24+ && rm -rf /var/lib/apt/lists/*
1625
1726WORKDIR /usr/src/app
1827
@@ -23,11 +32,11 @@ COPY pyproject.toml poetry.lock /usr/src/app/
2332
2433# Install the dependencies and clear the cache afterwards.
2534# This may save some MBs.
26- RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
35+ RUN --mount=type=tmpfs,target=/root/.cargo poetry install --no-root && rm -rf $POETRY_CACHE_DIR
2736
2837# Now let's build the runtime image from the builder.
2938# We'll just copy the env and the PATH reference.
30- FROM python:3.12 -slim AS runtime
39+ FROM python:${PYTHON_VERSION} -slim AS runtime
3140
3241WORKDIR /usr/src/app
3342
You can’t perform that action at this time.
0 commit comments