-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.33 KB
/
docker-ehrbase-postgres.yml
File metadata and controls
77 lines (66 loc) · 2.33 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
name: "Create Docker ehrbase-postgres"
on:
#
# Manual dispatched with postgres version and publish options.
#
workflow_dispatch:
inputs:
postgres-version:
description: 'Version of Postgres to build (like: 16.2)'
required: true
default: '16.2'
type: string
push-image:
description: 'Push the resulting image to dockerhub'
required: true
default: false
type: boolean
jobs:
build-docker-image:
runs-on: ubuntu-latest
env:
REGISTRY: docker.io
POSTGRES_VERSION: unspecified # assign from workflow input
IMAGE_NAME: ehrbase/ehrbase-v2-postgres
steps:
- name: Assign Env vars
run: |
echo "POSTGRES_VERSION=${{ inputs.postgres-version }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
# Docker registry login
- name: Login into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
if: ${{ !env.ACT }} # skip for local tests
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Docker metadata extraction - obtain version and labels from here
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
if: ${{ !env.ACT }} # skip for local tests
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# setup qemu for multi arch
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# setup buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Build & Publish image
- name: Build and push Versioned Docker Image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile_postgres
platforms: linux/amd64,linux/arm64
push: ${{ inputs.push-image }}
tags: ${{ env.IMAGE_NAME }}:${{ env.POSTGRES_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
build-args: POSTGRES_VERSION=${{ env.POSTGRES_VERSION }}
- name: Build and push Versioned Docker Image (Summary)
if: ${{ github.ref != 'refs/heads/main' }}
run: |
echo "Image \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.POSTGRES_VERSION }}\`" >> $GITHUB_STEP_SUMMARY