Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplatform docker #416

Merged
merged 4 commits into from
Nov 28, 2022
Merged
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
12 changes: 7 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1.6.0
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1.14.1
like-a-bause marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -75,13 +77,13 @@ jobs:
type=ref,event=tag
type=ref,event=pr


# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2.10.0
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: ${{ matrix.context }}
file: ${{ matrix.context }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
Expand Down
6 changes: 4 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build the hanko binary
FROM golang:1.17 as builder
FROM --platform=$BUILDPLATFORM golang:1.19 as builder

ARG TARGETARCH

WORKDIR /workspace
COPY go.mod go.mod
Expand All @@ -21,7 +23,7 @@ COPY audit_log audit_log/
COPY pagination pagination/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o hanko main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -a -o hanko main.go

# Use distroless as minimal base image to package hanko binary
# See https://github.com/GoogleContainerTools/distroless for details
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.16-alpine as build
FROM --platform=$BUILDPLATFORM node:16.16-alpine as build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion frontend/frontend-sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.16-alpine as build
FROM --platform=$BUILDPLATFORM node:16.16-alpine as build

WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
Expand Down
6 changes: 4 additions & 2 deletions quickstart/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Build the quickstart binary
FROM golang:1.17 as builder
FROM --platform=$BUILDPLATFORM golang:1.19 as builder

ARG TARGETARCH

WORKDIR /workspace
COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o quickstart main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -a -o quickstart main.go

# Use distroless as minimal base image to package quickstart binary
# See https://github.com/GoogleContainerTools/distroless for details
Expand Down