This repository was archived by the owner on Apr 4, 2026. It is now read-only.
forked from postgis/docker-postgis
-
Notifications
You must be signed in to change notification settings - Fork 1
231 lines (211 loc) · 8.32 KB
/
main.yml
File metadata and controls
231 lines (211 loc) · 8.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Docker PostGIS CI
on:
push:
pull_request:
schedule:
- cron: '15 5 * * 1'
defaults:
run:
shell: bash
jobs:
make-docker-images:
strategy:
matrix:
runner-platform: ['ubuntu-24.04', 'ubuntu-24.04-arm']
postgres: [13, 14, 15, 16, 17 ]
postgis: ['3.5']
variant: [default, alpine]
include:
- postgres: 16
postgis: master
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 17
postgis: master
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 16
postgis: master
variant: default
runner-platform: 'ubuntu-24.04-arm'
- postgres: 17
postgis: master
variant: default
runner-platform: 'ubuntu-24.04-arm'
- postgres: 17
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04'
- postgres: 17
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04-arm'
- postgres: 18
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04'
- postgres: 18
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04-arm'
- postgres: 18
postgis: '3.6'
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 18
postgis: '3.6'
variant: default
runner-platform: 'ubuntu-24.04-arm'
name: ${{ matrix.postgres }}-${{ matrix.postgis }}-${{ matrix.variant }} ${{ matrix.runner-platform }} - Build Docker image
runs-on: ${{ matrix.runner-platform }}
continue-on-error: ${{ matrix.postgis == 'master' }}
env:
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
VARIANT: ${{ matrix.variant }}
DOCKER_APT_PKG_VER: '5:29.2.1-1~ubuntu.24.04~noble'
steps:
- name: Install/config specific version of Docker packages
run: |
echo "***** Removing any currently installed conflicting packages..."
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
echo "***** Setting up Docker's APT repo..."
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
echo "***** Check available docker-ce versions ."
sudo apt policy docker-ce
echo "***** Installing Docker packages..."
sudo apt-get install docker-ce=${{ env.DOCKER_APT_PKG_VER }} docker-ce-cli=${{ env.DOCKER_APT_PKG_VER }} containerd.io docker-buildx-plugin docker-compose-plugin
echo "***** Verifying initial Docker installation..."
docker run hello-world
echo "***** Displaying Docker information..."
docker info
echo "***** Configuring Docker for containerd image store and builder keepStorage..."
echo "{ \"features\": { \"containerd-snapshotter\": true }}" | sudo tee /etc/docker/daemon.json
echo $'{
"features": {
"containerd-snapshotter": true
},
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
}
}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
docker info -f '{{ .DriverStatus }}'
- name: Load binfmt platforms for QEMU
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
docker images --tree
- name: Checkout source
uses: actions/checkout@v4
- name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }}
run: make test
- name: Login to dockerhub
uses: docker/login-action@v3
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Determine architecture suffix
id: arch
run: |
if [ "${{ matrix.runner-platform }}" = "ubuntu-24.04" ]; then
echo "suffix=amd64" >> "$GITHUB_OUTPUT"
else
echo "suffix=arm64" >> "$GITHUB_OUTPUT"
fi
- name: Push arch-tagged docker image to dockerhub
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
ARCH: ${{ steps.arch.outputs.suffix }}
REPO_NAME: postgis
IMAGE_NAME: postgis
run: |
VERSION="${{ env.VERSION }}"
if [ "${{ env.VARIANT }}" = "default" ]; then
docker image tag ${REPO_NAME}/${IMAGE_NAME}:${VERSION} ${REPO_NAME}/${IMAGE_NAME}:${VERSION}-${ARCH}
docker image push ${REPO_NAME}/${IMAGE_NAME}:${VERSION}-${ARCH}
fi
if [ "${{ env.VARIANT }}" = "alpine" ] && [ -d "${VERSION}/alpine" ]; then
docker image tag ${REPO_NAME}/${IMAGE_NAME}:${VERSION}-alpine ${REPO_NAME}/${IMAGE_NAME}:${VERSION}-alpine-${ARCH}
docker image push ${REPO_NAME}/${IMAGE_NAME}:${VERSION}-alpine-${ARCH}
fi
# Create multi-arch manifests combining amd64 and arm64 images
create-manifests:
needs: make-docker-images
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
strategy:
fail-fast: false
matrix:
postgres: [13, 14, 15, 16, 17]
postgis: ['3.5']
variant: [default, alpine]
include:
- postgres: 16
postgis: master
variant: default
- postgres: 17
postgis: master
variant: default
- postgres: 17
postgis: '3.6'
variant: alpine
- postgres: 18
postgis: '3.6'
variant: alpine
- postgres: 18
postgis: '3.6'
variant: default
name: manifest ${{ matrix.postgres }}-${{ matrix.postgis }}-${{ matrix.variant }}
runs-on: ubuntu-24.04
continue-on-error: ${{ matrix.postgis == 'master' }}
env:
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
VARIANT: ${{ matrix.variant }}
REPO_NAME: postgis
IMAGE_NAME: postgis
steps:
- name: Login to dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Create and push multi-arch manifest
run: |
if [ "${{ env.VARIANT }}" = "default" ]; then
TAG="${{ env.VERSION }}"
else
TAG="${{ env.VERSION }}-${{ env.VARIANT }}"
fi
echo "Creating manifest for ${REPO_NAME}/${IMAGE_NAME}:${TAG}"
docker manifest create ${REPO_NAME}/${IMAGE_NAME}:${TAG} \
${REPO_NAME}/${IMAGE_NAME}:${TAG}-amd64 \
${REPO_NAME}/${IMAGE_NAME}:${TAG}-arm64
docker manifest push ${REPO_NAME}/${IMAGE_NAME}:${TAG}
- name: Create latest manifest
if: ${{ env.VERSION == '17-3.5' && env.VARIANT == 'default' }}
run: |
docker manifest create ${REPO_NAME}/${IMAGE_NAME}:latest \
${REPO_NAME}/${IMAGE_NAME}:17-3.5-amd64 \
${REPO_NAME}/${IMAGE_NAME}:17-3.5-arm64
docker manifest push ${REPO_NAME}/${IMAGE_NAME}:latest
- name: Inspect manifest
run: |
if [ "${{ env.VARIANT }}" = "default" ]; then
TAG="${{ env.VERSION }}"
else
TAG="${{ env.VERSION }}-${{ env.VARIANT }}"
fi
docker manifest inspect ${REPO_NAME}/${IMAGE_NAME}:${TAG}