Skip to content

Commit a8aa901

Browse files
committed
Add GitHub Actions workflow for building Docker image
Configure a workflow to build a multi-platform Docker image for the repository, supporting both amd64 and arm64 architectures. The workflow includes steps for: - Checking out the repository - Setting up QEMU and Docker Buildx - Logging into the GitHub Container Registry - Extracting Docker metadata - Building (but not pushing) the Docker image
1 parent 4f3ef30 commit a8aa901

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build Docker image
2+
on:
3+
workflow_dispatch:
4+
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{ github.repository }}
8+
9+
jobs:
10+
build-and-push-docker-image:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout Elementary
18+
uses: actions/checkout@v4
19+
20+
- name: Set up QEMU for multi-platform support
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx for multi-platform support
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to the container registry
27+
uses: docker/login-action@v2
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v4
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v3
41+
with:
42+
context: .
43+
push: false
44+
platforms: linux/amd64,linux/arm64
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)