Implement CI for UI, Logical Backup Images to GHCR (#2527)
* Implement CI for UI, Logical Backup Images to GHCR --------- Co-authored-by: Felix Kunde <felix-kunde@gmx.de>
This commit is contained in:
		
							parent
							
								
									886cb86797
								
							
						
					
					
						commit
						569fc57fc8
					
				|  | @ -1,4 +1,4 @@ | ||||||
| name: Publish multiarch postgres-operator image on ghcr.io | name: Publish multiarch postgres-operator images on ghcr.io | ||||||
| 
 | 
 | ||||||
| env: | env: | ||||||
|   REGISTRY: ghcr.io |   REGISTRY: ghcr.io | ||||||
|  | @ -9,6 +9,7 @@ on: | ||||||
|   push: |   push: | ||||||
|     tags: |     tags: | ||||||
|       - '*' |       - '*' | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   publish: |   publish: | ||||||
|     name: Build, test and push image |     name: Build, test and push image | ||||||
|  | @ -30,14 +31,20 @@ jobs: | ||||||
|       - name: Define image name |       - name: Define image name | ||||||
|         id: image |         id: image | ||||||
|         run: | |         run: | | ||||||
|             IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}" |             OPERATOR_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}" | ||||||
|             echo "NAME=${IMAGE,,}" >> $GITHUB_OUTPUT |             echo "OPERATOR_IMAGE=$OPERATOR_IMAGE" >> $GITHUB_OUTPUT | ||||||
| 
 | 
 | ||||||
|       - name: Define image name |       - name: Define UI image name | ||||||
|         id: image_ui |         id: image_ui | ||||||
|         run: | |         run: | | ||||||
|             IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}:${GITHUB_REF/refs\/tags\//}" |             UI_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UI }}:${GITHUB_REF/refs\/tags\//}" | ||||||
|             echo "NAME=${IMAGE,,}" >> $GITHUB_OUTPUT |             echo "UI_IMAGE=$UI_IMAGE" >> $GITHUB_OUTPUT | ||||||
|  | 
 | ||||||
|  |       - name: Define logical backup image name | ||||||
|  |         id: image_lb | ||||||
|  |         run: | | ||||||
|  |             BACKUP_IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/logical-backup:${GITHUB_REF_NAME}" | ||||||
|  |             echo "BACKUP_IMAGE=$BACKUP_IMAGE" >> $GITHUB_OUTPUT | ||||||
| 
 | 
 | ||||||
|       - name: Set up QEMU |       - name: Set up QEMU | ||||||
|         uses: docker/setup-qemu-action@v2 |         uses: docker/setup-qemu-action@v2 | ||||||
|  | @ -52,23 +59,30 @@ jobs: | ||||||
|           username: ${{ github.actor }} |           username: ${{ github.actor }} | ||||||
|           password: ${{ secrets.GITHUB_TOKEN }} |           password: ${{ secrets.GITHUB_TOKEN }} | ||||||
| 
 | 
 | ||||||
|       - name: Build and push multiarch image to ghcr |       - name: Build and push multiarch operator image to ghcr | ||||||
|         uses: docker/build-push-action@v3 |         uses: docker/build-push-action@v3 | ||||||
|         with: |         with: | ||||||
|           context: . |           context: . | ||||||
|           file: docker/Dockerfile |           file: docker/Dockerfile | ||||||
|           push: true |           push: true | ||||||
|           build-args: BASE_IMAGE=alpine:3.15 |           build-args: BASE_IMAGE=alpine:3.15 | ||||||
|           tags: "${{ steps.image.outputs.NAME }}" |           tags: "${{ steps.image.outputs.OPERATOR_IMAGE }}" | ||||||
|           platforms: linux/amd64,linux/arm64 |           platforms: linux/amd64,linux/arm64 | ||||||
| 
 | 
 | ||||||
|       - name: Build and push multiarch image to ghcr for UI |       - name: Build and push multiarch ui image to ghcr | ||||||
|         uses: docker/build-push-action@v3 |         uses: docker/build-push-action@v3 | ||||||
|         with: |         with: | ||||||
|           context: ${{ github.workspace }}/ui |           context: ui | ||||||
|           file: ${{ github.workspace }}/ui/Dockerfile |  | ||||||
|           push: true |           push: true | ||||||
|           build-args: BASE_IMAGE=alpine:3.15 |           build-args: BASE_IMAGE=alpine:3.15 | ||||||
|           tags: "${{ steps.image_ui.outputs.NAME }}" |           tags: "${{ steps.image_ui.outputs.UI_IMAGE }}" | ||||||
|           platforms: linux/amd64,linux/arm64 |           platforms: linux/amd64,linux/arm64 | ||||||
| 
 | 
 | ||||||
|  |       - name: Build and push multiarch logical-backup image to ghcr | ||||||
|  |         uses: docker/build-push-action@v3 | ||||||
|  |         with: | ||||||
|  |           context: docker/logical-backup | ||||||
|  |           push: true | ||||||
|  |           build-args: BASE_IMAGE=ubuntu:22.04 | ||||||
|  |           tags: "${{ steps.image_lb.outputs.BACKUP_IMAGE }}" | ||||||
|  |           platforms: linux/amd64,linux/arm64 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| FROM registry.opensource.zalan.do/library/ubuntu-22.04:latest | ARG BASE_IMAGE=registry.opensource.zalan.do/library/ubuntu-22.04:latest | ||||||
|  | FROM ${BASE_IMAGE} | ||||||
| LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>" | LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>" | ||||||
| 
 | 
 | ||||||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||||||
|  |  | ||||||
|  | @ -1,5 +1,16 @@ | ||||||
| ARG BASE_IMAGE=registry.opensource.zalan.do/library/alpine-3.15:latest | ARG BASE_IMAGE=registry.opensource.zalan.do/library/alpine-3.15:latest | ||||||
| FROM ${BASE_IMAGE} | ARG NODE_IMAGE=node:14.21.2-alpine | ||||||
|  | 
 | ||||||
|  | FROM $NODE_IMAGE AS build | ||||||
|  | 
 | ||||||
|  | COPY . /workdir | ||||||
|  | WORKDIR /workdir/app | ||||||
|  | 
 | ||||||
|  | RUN npm install &&\ | ||||||
|  |     npm run build | ||||||
|  | 
 | ||||||
|  | FROM $BASE_IMAGE | ||||||
|  | 
 | ||||||
| LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>" | LABEL maintainer="Team ACID @ Zalando <team-acid@zalando.de>" | ||||||
| 
 | 
 | ||||||
| EXPOSE 8081 | EXPOSE 8081 | ||||||
|  | @ -34,7 +45,7 @@ COPY start_server.sh / | ||||||
| RUN pip3 install -r /requirements.txt | RUN pip3 install -r /requirements.txt | ||||||
| 
 | 
 | ||||||
| COPY operator_ui /operator_ui | COPY operator_ui /operator_ui | ||||||
| 
 | COPY --from=build /workdir/operator_ui/static/build /operator_ui/static/build | ||||||
| ARG VERSION=dev | ARG VERSION=dev | ||||||
| RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /operator_ui/__init__.py | RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /operator_ui/__init__.py | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue