Skip to content

Commit a5c2a66

Browse files
committed
docker: refactor to use bake/buildx, new generic images
1 parent 9ea7eb0 commit a5c2a66

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed

.github/workflows/docker.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,47 @@ jobs:
2121
password: ${{ secrets.CR_PAT }}
2222
- name: Set version
2323
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
24-
- name: Build and push
25-
id: docker_build
26-
uses: docker/build-push-action@v2
24+
- name: Docker metadata
25+
id: meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
images: |
29+
ghcr.io/${{ github.repository_owner }}/void-updates
30+
tags: |
31+
type=sha,prefix=
32+
type=raw,value=latest
33+
type=raw,value=${{env.RELEASE_VERSION}},priority=1000
34+
flavor: latest=false
35+
labels: |
36+
org.opencontainers.image.authors=Void Linux team and contributors
37+
org.opencontainers.image.url=https://voidlinux.org
38+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
39+
org.opencontainers.image.vendor=Void Linux
40+
org.opencontainers.image.title=void-updates
41+
org.opencontainers.image.description=Update check system for void-packages
42+
43+
- name: Set up QEMU
44+
uses: docker/setup-qemu-action@v2
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v2
48+
49+
- name: Login to GCHR
50+
uses: docker/login-action@v2
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Build and push images
57+
id: build_and_push
58+
uses: docker/bake-action@v3
2759
with:
2860
push: true
29-
tags: "ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}"
61+
targets: void-updates
62+
files: |
63+
services/pkg/docker-bake.hcl
64+
${{ steps.meta.outputs.bake-file }}
65+
set: |
66+
_common.cache-to=type=gha
67+
_common.cache-from=type=gha

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ARG BASE=ghcr.io/void-linux/void-linux:20220530RC01-full-x86_64-musl
1+
ARG BASE=ghcr.io/void-linux/void-musl-full:20231003R1
22
FROM ${BASE}
3-
RUN xbps-install -yMu xbps && xbps-install -yMU git bash curl util-linux findutils
3+
RUN xbps-install -yMu xbps && xbps-install -yMu git bash curl util-linux findutils
44
COPY void-updates.sh /usr/local/bin/void-updates
55
COPY entrypoint.sh /entrypoint
66

docker-bake.hcl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
target "docker-metadata-action" {}
2+
3+
target "_common" {
4+
inherits = ["docker-metadata-action"]
5+
dockerfile = "Dockerfile"
6+
cache-to = ["type=local,dest=/tmp/buildx-cache"]
7+
cache-from = ["type=local,src=/tmp/buildx-cache"]
8+
}
9+
10+
target "void-updates" {
11+
inherits = ["_common"]
12+
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
13+
args = { "LIBC" = "musl" }
14+
}
15+

0 commit comments

Comments
 (0)