Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Publish a docker image #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
release:
name: Create release
runs-on: ubuntu-latest

steps:
Expand All @@ -20,3 +21,57 @@ jobs:
- run: gh release create v${{ steps.versions.outputs.changelog-latest-version }} go/dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

outputs:
latest-release: ${{ steps.versions.outputs.changelog-latest-version }}

docker:
name: Publish docker images
runs-on: ubuntu-latest
needs: release

steps:
- name: Download binaries
id: download
run: |
gh release download -D /tmp/binaries -R ${{ github.repository }} v${{ needs.release.outputs.latest-release }}

echo ::set-output name=binary-directory::/tmp/binaries

echo "::group::Downloaded"
ls -al /tmp/binaries
echo "::endgroup::"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/setup-qemu-action@v1

- uses: docker/setup-buildx-action@v1

- uses: docker/metadata-action@v4
id: meta
with:
tags: |
type=semver,value=${{ needs.release.outputs.latest-release }},pattern={{major}}.{{minor}}.{{patch}}
type=semver,value=${{ needs.release.outputs.latest-release }},pattern={{major}}.{{minor}}
type=semver,value=${{ needs.release.outputs.latest-release }},pattern={{major}}
images: ${{ github.repository }}

- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:docker"
push: true
platforms: |
linux/386
linux/arm
linux/amd64
linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-contexts: |
binaries=${{ steps.download.outputs.binary-directory }}
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
default:
default: build

build:
cd testdata && make
cd go && make

clean:
cd testdata && make clean
cd go && make clean

.PHONY: default clean
docker: build
docker buildx build ./docker --load --tag=cucumber/json-formatter:latest --build-context binaries=./go/dist

.PHONY: default build clean docker
9 changes: 9 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM scratch

ARG TARGETOS
ARG TARGETARCH
ARG PREFIX=cucumber-json-formatter

COPY --chmod=755 --from=binaries ${PREFIX}-${TARGETOS}-${TARGETARCH} /cucumber-json-formatter

ENTRYPOINT ["/cucumber-json-formatter"]