Skip to content

Commit

Permalink
add a ghcr.io container artifact for metal-cli relesaes
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <mjohansson@equinix.com>
  • Loading branch information
displague committed Feb 23, 2023
1 parent 6eb3511 commit 28eb1cb
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
args: release --clean
env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
Expand Down
14 changes: 14 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,17 @@ brews:
tap:
owner: equinix
name: homebrew-tap

dockers:
- image_templates:
- 'ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1

## Build
FROM golang:1.19-alpine AS build

WORKDIR /app

COPY go.mod ./
COPY go.sum ./
RUN go mod download

COPY ./cmd/. ./cmd/
COPY ./internal/. ./internal/
RUN go build -o /metal ./cmd/metal

## Image
FROM scratch

WORKDIR /

COPY --from=build /metal /metal

USER nonroot:nonroot

ENTRYPOINT ["/metal"]

0 comments on commit 28eb1cb

Please sign in to comment.