add aarch64/arm64 docker build

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey 2022-12-23 22:51:51 +01:00
parent c1a6a6f586
commit 44a1a68db7
No known key found for this signature in database
GPG key ID: 02A3919EB4F67328
4 changed files with 27 additions and 6 deletions

View file

@ -16,6 +16,9 @@ jobs:
- name: Check Out Repo - name: Check Out Repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Generate Docker metadata - name: Generate Docker metadata
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
@ -61,6 +64,7 @@ jobs:
with: with:
context: . context: .
file: ./docker/server/Dockerfile file: ./docker/server/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@ -77,6 +81,9 @@ jobs:
- name: Check Out Repo - name: Check Out Repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Generate Docker metadata - name: Generate Docker metadata
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
@ -125,6 +132,7 @@ jobs:
with: with:
context: . context: .
file: ./docker/proxy/Dockerfile file: ./docker/proxy/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View file

@ -13,6 +13,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
@ -21,6 +24,7 @@ jobs:
with: with:
context: . context: .
file: docker/server/Dockerfile file: docker/server/Dockerfile
platforms: linux/amd64,linux/arm64
proxy: proxy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -28,6 +32,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
@ -36,3 +43,4 @@ jobs:
with: with:
context: . context: .
file: docker/proxy/Dockerfile file: docker/proxy/Dockerfile
platforms: linux/amd64,linux/arm64

View file

@ -1,12 +1,14 @@
FROM golang:1.19 AS builder FROM --platform=${BUILDPLATFORM} golang:1.19 AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workdir WORKDIR /workdir
COPY . . COPY . .
RUN apt-get -y update && \ RUN apt-get -y update && \
apt-get -y install protobuf-compiler && \ apt-get -y install protobuf-compiler && \
if [ -d "vendor" ]; then GOPROXY=off make proxy -j$(nproc); else \ if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make proxy -j$(nproc); else \
make proxy -j$(nproc); fi GOOS=${TARGETOS} GOARCH=${TARGETARCH} make proxy -j$(nproc); fi
FROM alpine:3 FROM alpine:3

View file

@ -1,12 +1,15 @@
FROM golang:1.19 AS builder FROM --platform=${BUILDPLATFORM} golang:1.19 AS builder
WORKDIR /workdir WORKDIR /workdir
ARG TARGETARCH
ARG TARGETOS
COPY . . COPY . .
RUN apt-get -y update && \ RUN apt-get -y update && \
apt-get -y install protobuf-compiler && \ apt-get -y install protobuf-compiler && \
if [ -d "vendor" ]; then GOPROXY=off make server -j$(nproc); else \ if [ -d "vendor" ]; then GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOPROXY=off make server -j$(nproc); else \
make server -j$(nproc); fi GOOS=${TARGETOS} GOARCH=${TARGETARCH} make server -j$(nproc); fi
FROM alpine:3 FROM alpine:3