From 319e3b1eba11ba31171cb6b810f2182e74dac148 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Tue, 8 Jul 2025 00:13:14 +0200 Subject: [PATCH] use musl gcc for docker #651 Co-authored-by: @elseif --- Dockerfile | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a4e01a..33f68f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,20 +6,35 @@ RUN npm install && npm run build FROM golang:1.24-alpine AS backend-builder WORKDIR /app ARG TARGETARCH -ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE" ENV CGO_ENABLED=1 +ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE" ENV GOARCH=$TARGETARCH -RUN apk update && apk --no-cache --update add build-base gcc wget unzip + +RUN apk update && apk add --no-cache \ + gcc \ + musl-dev \ + libc-dev \ + make \ + git \ + wget \ + unzip \ + bash + +ENV CC=gcc + COPY . . -COPY --from=front-builder /app/dist/ /app/web/html/ -RUN go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go +COPY --from=front-builder /app/dist/ /app/web/html/ + +RUN go build -ldflags="-w -s" \ + -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" \ + -o sui main.go FROM --platform=$TARGETPLATFORM alpine LABEL org.opencontainers.image.authors="alireza7@gmail.com" ENV TZ=Asia/Tehran WORKDIR /app -RUN apk add --no-cache --update ca-certificates tzdata -COPY --from=backend-builder /app/sui /app/ +RUN apk add --no-cache --update ca-certificates tzdata +COPY --from=backend-builder /app/sui /app/ COPY entrypoint.sh /app/ VOLUME [ "s-ui" ] ENTRYPOINT [ "./entrypoint.sh" ] \ No newline at end of file