Files
go-lcg/Dockerfiles/ImageBuild/Dockerfile
2024-12-03 18:00:10 +06:00

25 lines
586 B
Docker

FROM --platform=${BUILDPLATFORM} golang:1.23-alpine AS builder
ARG TARGETARCH
RUN apk add git && go install mvdan.cc/garble@latest
WORKDIR /app
COPY . .
RUN echo $BUILDPLATFORM > buildplatform
RUN echo $TARGETARCH > targetarch
# RUN GOOS=linux GOARCH=$TARGETARCH go build -o /app/go-lcg .
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} garble -literals -tiny build -ldflags="-w -s" -o /app/go-lcg .
FROM alpine:latest
WORKDIR /root
# COPY --from=builder /app/buildplatform .
# COPY --from=builder /app/targetarch .
COPY --from=builder /app/go-lcg /root/lcg
ENTRYPOINT ["/root/lcg"]