From b6fe87df87e06312478f83ce7c73d5f3cf0c43af Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 12 Feb 2025 10:23:01 +0900 Subject: [PATCH 1/3] ci(workflow): add release test workflow for Docker images --- .github/workflows/release-test.yml | 66 ++++++++++++++++++++++++++++++ Dockerfile | 1 + 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..f3ce3227 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,66 @@ +name: release test + +on: + push: + branches: + - main + pull_request: + paths: + - .github/workflows/release-test.yml + - .goreleaser.yml + +jobs: + dockerimage: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get latest version + id: latest_version + run: | + echo -n 'version=' > $GITHUB_OUTPUT + gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build (slim) + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile.slim + platforms: linux/amd64,linux/arm64 + push: false + tags: | + ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }}-slim + ghcr.io/k1low/runn:latest-slim + labels: | + org.opencontainers.image.name=runn + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} + org.opencontainers.image.source=https://github.com/k1LoW/runn + + - name: Build + uses: docker/build-push-action@v6 + with: + context: . + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: false + tags: | + ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }} + ghcr.io/k1low/runn:latest + labels: | + org.opencontainers.image.name=runn + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} + org.opencontainers.image.source=https://github.com/k1LoW/runn diff --git a/Dockerfile b/Dockerfile index 412be877..cd0afc1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN make build FROM debian:bullseye-slim RUN apt-get update \ + && dpkg --configure -a \ && apt-get install -y fonts-noto-cjk \ && apt-get install -y chromium \ && apt-get install -y git \ From 41b214a5df6294ea183128d882d0e9e42af51937 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 12 Feb 2025 12:14:44 +0900 Subject: [PATCH 2/3] ci(workflows): split dockerimage job into dockerimage and dockerimage-slim --- .github/workflows/release-test.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index f3ce3227..08b09fa3 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -10,7 +10,7 @@ on: - .goreleaser.yml jobs: - dockerimage: + dockerimage-slim: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -49,6 +49,29 @@ jobs: org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} org.opencontainers.image.source=https://github.com/k1LoW/runn + dockerimage: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get latest version + id: latest_version + run: | + echo -n 'version=' > $GITHUB_OUTPUT + gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build uses: docker/build-push-action@v6 with: From a01f02d0f1756eca7a14ef7cc5202a0458dc2a27 Mon Sep 17 00:00:00 2001 From: k1LoW Date: Wed, 12 Feb 2025 12:29:03 +0900 Subject: [PATCH 3/3] chore(Dockerfile): update base images to bookworm --- Dockerfile | 5 ++--- Dockerfile.slim | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index cd0afc1d..5610c57f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1-bullseye AS builder +FROM golang:1-bookworm AS builder WORKDIR /workdir/ COPY . /workdir/ @@ -9,10 +9,9 @@ RUN update-ca-certificates RUN make build -FROM debian:bullseye-slim +FROM debian:bookworm-slim RUN apt-get update \ - && dpkg --configure -a \ && apt-get install -y fonts-noto-cjk \ && apt-get install -y chromium \ && apt-get install -y git \ diff --git a/Dockerfile.slim b/Dockerfile.slim index 8b3921c6..c41d2c94 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -1,4 +1,4 @@ -FROM golang:1-bullseye AS builder +FROM golang:1-bookworm AS builder WORKDIR /workdir/ COPY . /workdir/ @@ -9,7 +9,7 @@ RUN update-ca-certificates RUN make build -FROM debian:bullseye-slim +FROM debian:bookworm-slim COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /workdir/runn ./usr/bin