Skip to content

Commit

Permalink
docker: refactor to use bake/buildx, new generic images
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Oct 23, 2023
1 parent 9ea7eb0 commit a5c2a66
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
46 changes: 42 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,47 @@ jobs:
password: ${{ secrets.CR_PAT }}
- name: Set version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/void-updates
tags: |
type=sha,prefix=
type=raw,value=latest
type=raw,value=${{env.RELEASE_VERSION}},priority=1000
flavor: latest=false
labels: |
org.opencontainers.image.authors=Void Linux team and contributors
org.opencontainers.image.url=https://voidlinux.org
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=Void Linux
org.opencontainers.image.title=void-updates
org.opencontainers.image.description=Update check system for void-packages
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GCHR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
id: build_and_push
uses: docker/bake-action@v3
with:
push: true
tags: "ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}"
targets: void-updates
files: |
services/pkg/docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
set: |
_common.cache-to=type=gha
_common.cache-from=type=gha
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE=ghcr.io/void-linux/void-linux:20220530RC01-full-x86_64-musl
ARG BASE=ghcr.io/void-linux/void-musl-full:20231003R1
FROM ${BASE}
RUN xbps-install -yMu xbps && xbps-install -yMU git bash curl util-linux findutils
RUN xbps-install -yMu xbps && xbps-install -yMu git bash curl util-linux findutils
COPY void-updates.sh /usr/local/bin/void-updates
COPY entrypoint.sh /entrypoint

Expand Down
15 changes: 15 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
target "docker-metadata-action" {}

target "_common" {
inherits = ["docker-metadata-action"]
dockerfile = "Dockerfile"
cache-to = ["type=local,dest=/tmp/buildx-cache"]
cache-from = ["type=local,src=/tmp/buildx-cache"]
}

target "void-updates" {
inherits = ["_common"]
platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/arm/v6"]
args = { "LIBC" = "musl" }
}

0 comments on commit a5c2a66

Please sign in to comment.