Skip to content

Commit

Permalink
Merge pull request #1174 from k1LoW/fix-docker-image
Browse files Browse the repository at this point in the history
ci(workflow): add release test workflow for Docker images
  • Loading branch information
k1LoW authored Feb 12, 2025
2 parents f2ebc09 + a01f02d commit da21340
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 4 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: release test

on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/release-test.yml
- .goreleaser.yml

jobs:
dockerimage-slim:
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
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:
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1-bullseye AS builder
FROM golang:1-bookworm AS builder

WORKDIR /workdir/
COPY . /workdir/
Expand All @@ -9,7 +9,7 @@ RUN update-ca-certificates

RUN make build

FROM debian:bullseye-slim
FROM debian:bookworm-slim

RUN apt-get update \
&& apt-get install -y fonts-noto-cjk \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1-bullseye AS builder
FROM golang:1-bookworm AS builder

WORKDIR /workdir/
COPY . /workdir/
Expand All @@ -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
Expand Down

0 comments on commit da21340

Please sign in to comment.