Skip to content

Commit 5e7e83a

Browse files
committed
Add separate Dockerfiles for each base
1 parent 9828f4b commit 5e7e83a

6 files changed

Lines changed: 74 additions & 36 deletions

File tree

.github/workflows/build-and-push.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,8 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
base_version:
27-
- 16-alpine
28-
- 16-alpine3.21
29-
- 16-alpine3.22
30-
- 16-trixie
31-
- 15-alpine
32-
- 15-alpine3.21
33-
- 15-alpine3.22
34-
- 15-trixie
35-
- 14-alpine
36-
- 14-alpine3.21
37-
- 14-alpine3.22
38-
- 14-trixie
39-
- 13-alpine
40-
- 13-alpine3.21
41-
- 13-alpine3.22
42-
- 13-trixie
26+
postgres_version: ["13", "14", "15", "16"]
27+
os_version: ["alpine", "alpine3.21", "alpine3.22", "trixie"]
4328

4429
steps:
4530
- name: Checkout
@@ -60,12 +45,13 @@ jobs:
6045
username: ${{ github.actor }}
6146
password: ${{ secrets.GITHUB_TOKEN }}
6247

63-
- name: Build and push (${{ matrix.base_version }})
48+
- name: Build and push (${{ matrix.postgres_version }}-${{ matrix.os_version }})
6449
run: |
6550
docker buildx build \
6651
--platform linux/amd64,linux/arm64 \
67-
--build-arg BASE_VERSION=${{ matrix.base_version }} \
68-
--tag $IMAGE_NAME:${{ matrix.base_version }} \
52+
--build-arg POSTGRES_VERSION=${{ matrix.postgres_version }} \
53+
--file Dockerfile.${{ matrix.os_version }} \
54+
--tag $IMAGE_NAME:${{ matrix.postgres_version }}-${{ matrix.os_version }} \
6955
--push \
7056
.
7157

Dockerfile

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

Dockerfile.alpine

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ARG POSTGRES_VERSION
2+
FROM postgres:${POSTGRES_VERSION}-alpine
3+
4+
ENV BUILD_DEPS="build-base git clang llvm lld postgresql-server-dev-${POSTGRES_VERSION}"
5+
RUN apk add --no-cache --virtual .build-deps ${BUILD_DEPS} && \
6+
git clone --depth=1 https://github.com/citusdata/pg_cron /tmp/pg_cron && \
7+
make -C /tmp/pg_cron \
8+
CLANG="$(command -v clang)" \
9+
LLVM_CONFIG="$(command -v llvm-config)" \
10+
LLVM_AR="$(command -v llvm-ar)" \
11+
LLVM_RANLIB="$(command -v llvm-ranlib)" \
12+
LLVM_LTO="$(command -v llvm-lto)" && \
13+
make -C /tmp/pg_cron install && \
14+
rm -rf /tmp/pg_cron && \
15+
apk del .build-deps && \
16+
echo "shared_preload_libraries = 'pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample

Dockerfile.alpine3.21

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ARG POSTGRES_VERSION
2+
FROM postgres:${POSTGRES_VERSION}-alpine3.21
3+
4+
ENV BUILD_DEPS="build-base git clang llvm lld"
5+
RUN apk add --no-cache --virtual .build-deps ${BUILD_DEPS} && \
6+
git clone --depth=1 https://github.com/citusdata/pg_cron /tmp/pg_cron && \
7+
make -C /tmp/pg_cron \
8+
CLANG="$(command -v clang)" \
9+
LLVM_CONFIG="$(command -v llvm-config)" \
10+
LLVM_AR="$(command -v llvm-ar)" \
11+
LLVM_RANLIB="$(command -v llvm-ranlib)" \
12+
LLVM_LTO="$(command -v llvm-lto)" && \
13+
make -C /tmp/pg_cron install && \
14+
rm -rf /tmp/pg_cron && \
15+
apk del .build-deps && \
16+
echo "shared_preload_libraries = 'pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample

Dockerfile.alpine3.22

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ARG POSTGRES_VERSION
2+
FROM postgres:${POSTGRES_VERSION}-alpine3.22
3+
4+
ENV BUILD_DEPS="build-base git clang llvm lld"
5+
RUN apk add --no-cache --virtual .build-deps ${BUILD_DEPS} && \
6+
git clone --depth=1 https://github.com/citusdata/pg_cron /tmp/pg_cron && \
7+
make -C /tmp/pg_cron \
8+
CLANG="$(command -v clang)" \
9+
LLVM_CONFIG="$(command -v llvm-config)" \
10+
LLVM_AR="$(command -v llvm-ar)" \
11+
LLVM_RANLIB="$(command -v llvm-ranlib)" \
12+
LLVM_LTO="$(command -v llvm-lto)" && \
13+
make -C /tmp/pg_cron install && \
14+
rm -rf /tmp/pg_cron && \
15+
apk del .build-deps && \
16+
echo "shared_preload_libraries = 'pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample

Dockerfile.trixie

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG POSTGRES_VERSION
2+
FROM postgres:${POSTGRES_VERSION}-trixie
3+
4+
ENV BUILD_DEPS="build-essential git clang llvm lld"
5+
RUN apt-get update && \
6+
DEBIAN_FRONTEND=noninteractive apt-get install -y ${BUILD_DEPS} && \
7+
git clone --depth=1 https://github.com/citusdata/pg_cron /tmp/pg_cron && \
8+
make -C /tmp/pg_cron \
9+
CLANG="$(command -v clang)" \
10+
LLVM_CONFIG="$(command -v llvm-config)" \
11+
LLVM_AR="$(command -v llvm-ar)" \
12+
LLVM_RANLIB="$(command -v llvm-ranlib)" \
13+
LLVM_LTO="$(command -v llvm-lto)" && \
14+
make -C /tmp/pg_cron install && \
15+
rm -rf /tmp/pg_cron && \
16+
apt-get remove -y ${BUILD_DEPS} && \
17+
apt-get autoremove -y && \
18+
apt-get clean && \
19+
rm -rf /var/lib/apt/lists/* && \
20+
echo "shared_preload_libraries = 'pg_cron'" >> /usr/local/share/postgresql/postgresql.conf.sample

0 commit comments

Comments
 (0)