Skip to content

Commit

Permalink
Use alpine for architectures that distroless doesn't support
Browse files Browse the repository at this point in the history
  • Loading branch information
cromefire committed Oct 22, 2023
1 parent f2b9ede commit 7b3b7dd
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ env:
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:
strategy:
Expand All @@ -28,18 +27,23 @@ jobs:
platform:
- docker: linux/amd64
go: amd64
dockerfile: Dockerfile
- docker: linux/arm/v6
go: arm
qemu: arm
dockerfile: alpine.Dockerfile
- docker: linux/arm/v7
go: arm
qemu: arm
dockerfile: Dockerfile
- docker: linux/arm64
go: arm64
qemu: arm64
dockerfile: Dockerfile
- docker: linux/riscv64
go: riscv64
qemu: riscv64
dockerfile: alpine.Dockerfile
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -62,9 +66,9 @@ jobs:
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected].1
uses: sigstore/[email protected].2
with:
cosign-release: 'v2.1.1'
cosign-release: 'v2.2.0'

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
Expand Down Expand Up @@ -103,6 +107,7 @@ jobs:
uses: docker/[email protected]
with:
context: .
file: ${{ matrix.platform.dockerfile }}
build-args: GOARCH=${{ matrix.platform.go }}
platforms: ${{ matrix.platform.docker }}
push: ${{ github.event_name != 'pull_request' }}
Expand Down
36 changes: 36 additions & 0 deletions alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM golang:1.21-alpine as server_build

WORKDIR /appbuild

ARG GOARCH

# Add build deps
RUN apk add --update gcc g++ git

COPY go.mod go.sum /appbuild/

COPY ./ /appbuild

RUN CGO_ENABLED=0 GOOS=linux go build -o fritzbox-cloudflare-dyndns

# Build deployable server
FROM alpine:3

ENV FRITZBOX_ENDPOINT_URL=${FRITZBOX_ENDPOINT_URL:-http://fritz.box:49000} \
FRITZBOX_ENDPOINT_TIMEOUT=${FRITZBOX_ENDPOINT_TIMEOUT:-30s} \
DYNDNS_SERVER_BIND=${DYNDNS_SERVER_BIND:-:8080} \
DYNDNS_SERVER_USERNAME=${DYNDNS_SERVER_USERNAME} \
DYNDNS_SERVER_PASSWORD=${DYNDNS_SERVER_PASSWORD} \
CLOUDFLARE_API_EMAIL="" \
CLOUDFLARE_API_KEY="" \
CLOUDFLARE_ZONES_IPV4="" \
CLOUDFLARE_ZONES_IPV6="" \
CLOUDFLARE_LOCAL_ADDRESS_IPV6=""

WORKDIR /app

COPY --from=server_build /appbuild/fritzbox-cloudflare-dyndns /app/fritzbox-cloudflare-dyndns

EXPOSE 8080

CMD ["./fritzbox-cloudflare-dyndns"]

0 comments on commit 7b3b7dd

Please sign in to comment.