Skip to content

Commit 98ab7ca

Browse files
committed
Merge Dockerfiles into a single multi-stage file
1 parent 253cc7e commit 98ab7ca

4 files changed

Lines changed: 31 additions & 28 deletions

File tree

.github/workflows/build-root.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ jobs:
6868
uses: docker/build-push-action@v7
6969
with:
7070
context: .
71-
file: ./Dockerfile.base
71+
file: ./Dockerfile
72+
target: builder-base
7273
platforms: linux/amd64,linux/arm64
7374
push: ${{ github.ref == 'refs/heads/main' }}
7475
cache-to: type=inline

.github/workflows/build-version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
with:
4848
context: .
4949
file: ./Dockerfile
50+
target: python-builder
5051
platforms: linux/amd64,linux/arm64
5152
push: ${{ github.ref == 'refs/heads/main' }}
5253
cache-to: type=inline

Dockerfile

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
1-
FROM ghcr.io/python-discord/python-builds:builder-base AS python-builder
1+
FROM buildpack-deps:bookworm AS builder-base
22
LABEL org.opencontainers.image.authors="Joe Banks <joe@owlcorp.uk>, Chris Lovering <cj@owlcorp.uk>"
33

4+
ARG PYENV_VERSION="v2.6.11"
5+
6+
RUN apt-get -y update \
7+
&& apt-get install -y --no-install-recommends \
8+
libxmlsec1-dev \
9+
tk-dev \
10+
lsb-release \
11+
software-properties-common \
12+
gnupg \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Following guidance from https://github.com/python/cpython/blob/main/Tools/jit/README.md
16+
RUN curl -o /tmp/llvm.sh https://apt.llvm.org/llvm.sh \
17+
&& chmod +x /tmp/llvm.sh \
18+
&& /tmp/llvm.sh 19 \
19+
&& rm /tmp/llvm.sh
20+
21+
ENV PYENV_ROOT=/pyenv \
22+
PYTHON_CONFIGURE_OPTS='--disable-test-modules --enable-optimizations \
23+
--with-lto --without-ensurepip'
24+
25+
RUN git clone -b ${PYENV_VERSION} --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT
26+
27+
COPY --link scripts scripts
28+
29+
FROM builder-base AS python-builder
30+
431
ARG PYTHON_VERSION
532

633
RUN [ -z "$PYTHON_VERSION" ] && echo "PYTHON_VERSION Docker build arg is required" && exit 1 || true

Dockerfile.base

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)