From f0eb0852b864bc3367bdf4246785d929dff08ab4 Mon Sep 17 00:00:00 2001 From: qypol342 Date: Sun, 12 May 2024 20:33:58 +0200 Subject: [PATCH] Docker add build args for target platform --- Dockerfile | 4 +++- docker-compose.yml | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bb3bd0a..57ae9c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ # Start from the official golang image FROM golang:1.22-alpine AS builder +ARG GOARCH + # Set necessary environment variables ENV GO111MODULE=on \ CGO_ENABLED=0 \ GOOS=linux \ - GOARCH=amd64 + GOARCH=$GOARCH # Move to working directory /build WORKDIR /build diff --git a/docker-compose.yml b/docker-compose.yml index 6d021d4..424b5e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,5 +5,7 @@ services: build: context: . dockerfile: Dockerfile + args: + GOARCH: arm ports: - "8080:8080"