From 5f3db724227b32ba610f582af05dbc9ce5317de0 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sun, 21 Jun 2020 12:38:14 +0800 Subject: [PATCH] Fix: docker multiplatform build --- Dockerfile | 5 +++-- Makefile | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba3c66cd..e94a0d08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,11 @@ FROM golang:alpine as builder RUN apk add --no-cache make git && \ wget -O /Country.mmdb https://github.com/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb WORKDIR /clash-src +COPY --from=tonistiigi/xx:golang / / COPY . /clash-src RUN go mod download && \ - make linux-amd64 && \ - mv ./bin/clash-linux-amd64 /clash + make docker && \ + mv ./bin/clash-docker /clash FROM alpine:latest diff --git a/Makefile b/Makefile index f4c98195..fe6839f4 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,9 @@ WINDOWS_ARCH_LIST = \ all: linux-amd64 darwin-amd64 windows-amd64 # Most used +docker: + $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ + darwin-amd64: GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@