Skip to content

Commit c649af5

Browse files
deployment: add ci workflow to build base docker image
1 parent bc24421 commit c649af5

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Base-Image-Builder
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version tag for the image (e.g. v0.0.1). Always pushed."
8+
required: true
9+
type: string
10+
tag_latest:
11+
description: "Also tag this build as 'latest'. When false, only the version tag is pushed."
12+
required: false
13+
default: true
14+
type: boolean
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
REPO_NAME: ${{ github.repository }}
23+
24+
jobs:
25+
docker-build-push:
26+
runs-on: namespace-profile-small-ubuntu-24-04-amd64
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v6
31+
32+
# Login to a Docker registry except on PR
33+
# https://github.com/docker/login-action
34+
- name: Login to registry ${{ env.REGISTRY }}
35+
uses: docker/login-action@v2.1.0
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
logout: true
41+
42+
# Extract metadata (tags, labels) for Docker
43+
# https://github.com/docker/metadata-action
44+
- name: Extract Docker metadata
45+
id: meta
46+
uses: docker/metadata-action@v6.1.0
47+
with:
48+
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/ci-base
49+
tags: |
50+
# Immutable version tag, pushed on every build.
51+
type=raw,value=${{ inputs.version }}
52+
# Moving 'latest' tag, re-points to this build when enabled.
53+
type=raw,value=latest,enable=${{ inputs.tag_latest }}
54+
55+
# Build and push Docker image with Buildx
56+
# https://github.com/docker/build-push-action
57+
- name: Build and push Docker image
58+
uses: docker/build-push-action@v7.2.0
59+
with:
60+
context: .
61+
file: deployments/images/base/Dockerfile
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)