Skip to content

Commit 569fc57

Browse files
dgiebertFxKu
andauthored
Implement CI for UI, Logical Backup Images to GHCR (#2527)
* Implement CI for UI, Logical Backup Images to GHCR --------- Co-authored-by: Felix Kunde <[email protected]>
1 parent 886cb86 commit 569fc57

File tree

3 files changed

+41
-15
lines changed

3 files changed

+41
-15
lines changed

.github/workflows/publish_ghcr_image.yaml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish multiarch postgres-operator image on ghcr.io
1+
name: Publish multiarch postgres-operator images on ghcr.io
22

33
env:
44
REGISTRY: ghcr.io
@@ -9,6 +9,7 @@ on:
99
push:
1010
tags:
1111
- '*'
12+
1213
jobs:
1314
publish:
1415
name: Build, test and push image
@@ -30,14 +31,20 @@ jobs:
3031
- name: Define image name
3132
id: image
3233
run: |
33-
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}"
34-
echo "NAME=${IMAGE,,}" >> $GITHUB_OUTPUT
34+
OPERATOR_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}"
35+
echo "OPERATOR_IMAGE=$OPERATOR_IMAGE" >> $GITHUB_OUTPUT
3536
36-
- name: Define image name
37+
- name: Define UI image name
3738
id: image_ui
3839
run: |
39-
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}:${GITHUB_REF/refs\/tags\//}"
40-
echo "NAME=${IMAGE,,}" >> $GITHUB_OUTPUT
40+
UI_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}:${GITHUB_REF/refs\/tags\//}"
41+
echo "UI_IMAGE=$UI_IMAGE" >> $GITHUB_OUTPUT
42+
43+
- name: Define logical backup image name
44+
id: image_lb
45+
run: |
46+
BACKUP_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/logical-backup:${GITHUB_REF_NAME}"
47+
echo "BACKUP_IMAGE=$BACKUP_IMAGE" >> $GITHUB_OUTPUT
4148
4249
- name: Set up QEMU
4350
uses: docker/setup-qemu-action@v2
@@ -52,23 +59,30 @@ jobs:
5259
username: ${{ github.actor }}
5360
password: ${{ secrets.GITHUB_TOKEN }}
5461

55-
- name: Build and push multiarch image to ghcr
62+
- name: Build and push multiarch operator image to ghcr
5663
uses: docker/build-push-action@v3
5764
with:
5865
context: .
5966
file: docker/Dockerfile
6067
push: true
6168
build-args: BASE_IMAGE=alpine:3.15
62-
tags: "${{ steps.image.outputs.NAME }}"
69+
tags: "${{ steps.image.outputs.OPERATOR_IMAGE }}"
6370
platforms: linux/amd64,linux/arm64
6471

65-
- name: Build and push multiarch image to ghcr for UI
72+
- name: Build and push multiarch ui image to ghcr
6673
uses: docker/build-push-action@v3
6774
with:
68-
context: ${{ github.workspace }}/ui
69-
file: ${{ github.workspace }}/ui/Dockerfile
75+
context: ui
7076
push: true
7177
build-args: BASE_IMAGE=alpine:3.15
72-
tags: "${{ steps.image_ui.outputs.NAME }}"
78+
tags: "${{ steps.image_ui.outputs.UI_IMAGE }}"
7379
platforms: linux/amd64,linux/arm64
7480

81+
- name: Build and push multiarch logical-backup image to ghcr
82+
uses: docker/build-push-action@v3
83+
with:
84+
context: docker/logical-backup
85+
push: true
86+
build-args: BASE_IMAGE=ubuntu:22.04
87+
tags: "${{ steps.image_lb.outputs.BACKUP_IMAGE }}"
88+
platforms: linux/amd64,linux/arm64

docker/logical-backup/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM registry.opensource.zalan.do/library/ubuntu-22.04:latest
1+
ARG BASE_IMAGE=registry.opensource.zalan.do/library/ubuntu-22.04:latest
2+
FROM ${BASE_IMAGE}
23
LABEL maintainer="Team ACID @ Zalando <[email protected]>"
34

45
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ui/Dockerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
ARG BASE_IMAGE=registry.opensource.zalan.do/library/alpine-3.15:latest
2-
FROM ${BASE_IMAGE}
2+
ARG NODE_IMAGE=node:14.21.2-alpine
3+
4+
FROM $NODE_IMAGE AS build
5+
6+
COPY . /workdir
7+
WORKDIR /workdir/app
8+
9+
RUN npm install &&\
10+
npm run build
11+
12+
FROM $BASE_IMAGE
13+
314
LABEL maintainer="Team ACID @ Zalando <[email protected]>"
415

516
EXPOSE 8081
@@ -34,7 +45,7 @@ COPY start_server.sh /
3445
RUN pip3 install -r /requirements.txt
3546

3647
COPY operator_ui /operator_ui
37-
48+
COPY --from=build /workdir/operator_ui/static/build /operator_ui/static/build
3849
ARG VERSION=dev
3950
RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /operator_ui/__init__.py
4051

0 commit comments

Comments
 (0)