Skip to content

Commit

Permalink
Enable container image building and pushing:
Browse files Browse the repository at this point in the history
This uses goreleaser to build and push container
images to quay.io for multiple architectures.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Mar 1, 2022
1 parent 9643887 commit 4e48894
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Release
on:
push:
tags:
- "*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.5
- name: Login to quay.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ ipxe-*.tar.gz

# added by lint-install
out/

dist/
77 changes: 77 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
flags: -trimpath
ldflags: '-s -w -extldflags "-static"'
main: ./cmd/
goos:
- linux
- darwin
goarch:
- amd64
- arm64
- arm
archives:
- replacements:
darwin: Darwin
linux: Linux
amd64: x86_64
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
dockers:
- image_templates:
- "quay.io/tinkerbell/ipxedust:{{ .Version }}-amd64"
use: buildx
dockerfile: Dockerfile.goreleaser
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/amd64"
- image_templates:
- "quay.io/tinkerbell/ipxedust:{{ .Version }}-arm64"
use: buildx
goarch: arm64
dockerfile: Dockerfile.goreleaser
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/arm64"
- image_templates:
- "quay.io/tinkerbell/ipxedust:{{ .Version }}-arm"
use: buildx
goarch: arm
goarm: "6"
dockerfile: Dockerfile.goreleaser
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/arm/v6"
docker_manifests:
- name_template: quay.io/tinkerbell/ipxedust:{{ .Version }}
image_templates:
- quay.io/tinkerbell/ipxedust:{{ .Version }}-amd64
- quay.io/tinkerbell/ipxedust:{{ .Version }}-arm64
- quay.io/tinkerbell/ipxedust:{{ .Version }}-arm
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ RUN CGO_ENABLED=0 make build

FROM scratch

COPY --from=builder /code/bin/ipxedust-linux /ipxedust-linux
COPY --from=builder /code/bin/ipxedust-linux /ipxedust
EXPOSE 69/udp
EXPOSE 8080/tcp
ENV IPXE_TFTP_SINGLE_PORT=TRUE

ENTRYPOINT ["/ipxedust-linux"]
ENTRYPOINT ["/ipxedust"]
8 changes: 8 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM scratch

COPY ipxedust /ipxedust
EXPOSE 69/udp
EXPOSE 8080/tcp
ENV IPXE_TFTP_SINGLE_PORT=TRUE

ENTRYPOINT ["/ipxedust"]

0 comments on commit 4e48894

Please sign in to comment.