@@ -24,11 +24,7 @@ concurrency:
2424
2525# A workflow run is made up of one or more jobs that can run sequentially or in parallel
2626jobs :
27- image_postgresql :
28-
29- env :
30- PLATFORM : linux/amd64,linux/aarch64
31-
27+ image_postgresql_amd64 :
3228 runs-on : ubuntu-latest
3329
3430 steps :
6965 - name : Set tags
7066 run : |
7167 if [ -z "$TAG" ]; then
72- echo "TAG=-t openremote/postgresql:develop" >> $GITHUB_ENV
68+ echo "TAG=-t openremote/postgresql:develop-amd64 " >> $GITHUB_ENV
7369 else
74- echo "TAG=-t openremote/postgresql:latest -t openremote/postgresql: $TAG" >> $GITHUB_ENV
70+ echo "TAG=-t openremote/postgresql:$TAG-amd64 " >> $GITHUB_ENV
7571 fi
7672 env :
7773 TAG : ${{ github.event.release.tag_name }}
@@ -90,21 +86,130 @@ jobs:
9086 version : latest
9187 install : true
9288
93- - name : available platforms
94- run : echo ${{ steps.buildx.outputs.platforms }}
89+ - name : Login to DockerHub
90+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
91+ with :
92+ username : ${{ secrets._TEMP_DOCKERHUB_USER }}
93+ password : ${{ secrets._TEMP_DOCKERHUB_PASSWORD }}
9594
95+ - name : build and push amd64 image
96+ run : |
97+ docker buildx build \
98+ --build-arg GIT_COMMIT=${{ github.sha }} \
99+ --push \
100+ --platform linux/amd64 \
101+ --no-cache-filter trimmed \
102+ --no-cache-filter trimmed-all \
103+ $TAG .
104+
105+ image_postgresql_arm64 :
106+ needs : image_postgresql_amd64
107+ runs-on : ubuntu-latest
108+
109+ steps :
110+ - name : Free up disk space
111+ run : |
112+ echo "Disk space before cleanup:"
113+ df -h
114+
115+ # Remove large directories
116+ sudo rm -rf /usr/share/dotnet
117+ sudo rm -rf /usr/local/lib/android
118+ sudo rm -rf /opt/ghc
119+ sudo rm -rf /usr/local/.ghcup
120+ sudo rm -rf /opt/hostedtoolcache/CodeQL
121+
122+ # Remove large packages
123+ sudo apt-get remove -y '^aspnetcore-.*' || true
124+ sudo apt-get remove -y '^dotnet-.*' || true
125+ sudo apt-get remove -y '^llvm-.*' || true
126+ sudo apt-get remove -y 'php.*' || true
127+ sudo apt-get remove -y '^mongodb-.*' || true
128+ sudo apt-get remove -y '^mysql-.*' || true
129+ sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true
130+ sudo apt-get remove -y google-cloud-sdk google-cloud-cli || true
131+ sudo apt-get autoremove -y
132+ sudo apt-get clean
133+
134+ # Remove Docker images
135+ sudo docker image prune --all --force
136+
137+ # Remove swap storage
138+ sudo swapoff -a || true
139+ sudo rm -f /mnt/swapfile || true
140+
141+ echo "Disk space after cleanup:"
142+ df -h
143+
144+ - name : Set tags
145+ run : |
146+ if [ -z "$TAG" ]; then
147+ echo "TAG=-t openremote/postgresql:develop-arm64" >> $GITHUB_ENV
148+ else
149+ echo "TAG=-t openremote/postgresql:$TAG-arm64" >> $GITHUB_ENV
150+ fi
151+ env :
152+ TAG : ${{ github.event.release.tag_name }}
153+
154+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
155+
156+ - name : set up QEMU
157+ uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
158+ with :
159+ platforms : all
160+
161+ - name : install buildx
162+ id : buildx
163+ uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
164+ with :
165+ version : latest
166+ install : true
167+
96168 - name : Login to DockerHub
97169 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
98170 with :
99171 username : ${{ secrets._TEMP_DOCKERHUB_USER }}
100172 password : ${{ secrets._TEMP_DOCKERHUB_PASSWORD }}
101173
102- - name : build and push images
174+ - name : build and push arm64 image
103175 run : |
104176 docker buildx build \
105177 --build-arg GIT_COMMIT=${{ github.sha }} \
106178 --push \
107- --platform $PLATFORM \
179+ --platform linux/aarch64 \
108180 --no-cache-filter trimmed \
109181 --no-cache-filter trimmed-all \
110182 $TAG .
183+
184+ create_manifest :
185+ needs : [image_postgresql_amd64, image_postgresql_arm64]
186+ runs-on : ubuntu-latest
187+
188+ steps :
189+ - name : Set tags
190+ run : |
191+ if [ -z "$TAG" ]; then
192+ echo "TAG=openremote/postgresql:develop" >> $GITHUB_ENV
193+ echo "TAG_AMD64=openremote/postgresql:develop-amd64" >> $GITHUB_ENV
194+ echo "TAG_ARM64=openremote/postgresql:develop-arm64" >> $GITHUB_ENV
195+ else
196+ echo "TAG=openremote/postgresql:$TAG" >> $GITHUB_ENV
197+ echo "TAG_LATEST=openremote/postgresql:latest" >> $GITHUB_ENV
198+ echo "TAG_AMD64=openremote/postgresql:$TAG-amd64" >> $GITHUB_ENV
199+ echo "TAG_ARM64=openremote/postgresql:$TAG-arm64" >> $GITHUB_ENV
200+ fi
201+ env :
202+ TAG : ${{ github.event.release.tag_name }}
203+
204+ - name : Login to DockerHub
205+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
206+ with :
207+ username : ${{ secrets._TEMP_DOCKERHUB_USER }}
208+ password : ${{ secrets._TEMP_DOCKERHUB_PASSWORD }}
209+
210+ - name : Create and push multi-arch manifest
211+ run : |
212+ docker buildx imagetools create -t $TAG $TAG_AMD64 $TAG_ARM64
213+ if [ ! -z "$TAG_LATEST" ]; then
214+ docker buildx imagetools create -t $TAG_LATEST $TAG_AMD64 $TAG_ARM64
215+ fi
0 commit comments