diff --git a/Dockerfile b/Dockerfile index 498577e1..d011b20e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,10 @@ FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder WORKDIR /app ARG TARGETARCH -ARG TARGETPLATFORM +ARG TARGETOS ENV CGO_ENABLED=0 +ENV GOOS=$TARGETOS +ENV GOARCH=$TARGETARCH RUN apk --no-cache --update add \ build-base \ @@ -15,9 +17,7 @@ RUN apk --no-cache --update add \ COPY . . -RUN GOOS="$(echo "${TARGETPLATFORM}" | cut -d/ -f1)" \ - GOARCH="$(echo "${TARGETPLATFORM}" | cut -d/ -f2)" \ - go build -o build/x-ui main.go +RUN go build -o build/x-ui main.go RUN ./DockerInit.sh "$TARGETARCH" # ========================================================