Skip to content

Commit

Permalink
Add Docker build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cycneuramus committed Mar 13, 2024
1 parent aa9c61c commit 981e9df
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository_owner }}/cloudflare-dns-failover
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.22.1-alpine3.19 AS builder

ENV GOARCH $TARGETARCH
ENV CGO_ENABLED=0

WORKDIR /build
COPY *.go go.* ./

RUN go build -buildvcs=false -ldflags="-w -s" -o ./cloudflare-dns-failover

FROM scratch

COPY --from=builder /build/cloudflare-dns-failover /bin/cloudflare-dns-failover

ENTRYPOINT ["/bin/cloudflare-dns-failover"]

0 comments on commit 981e9df

Please sign in to comment.