23 lines
485 B
Docker
23 lines
485 B
Docker
# Accept GOOS and GOARCH as build arguments
|
|
ARG GOOS=linux
|
|
ARG GOARCH=amd64
|
|
|
|
# Build stage
|
|
FROM golang:1-alpine AS builder
|
|
WORKDIR /app
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="-s -w" -o zurg cmd/zurg/main.go
|
|
|
|
# Obfuscation stage
|
|
FROM alpine:3 AS obfuscator
|
|
WORKDIR /app
|
|
COPY --from=builder /app/zurg .
|
|
RUN apk add --no-cache upx
|
|
RUN upx --brute zurg
|
|
|
|
# Final stage
|
|
FROM alpine:3
|
|
WORKDIR /app
|
|
COPY --from=obfuscator /app/zurg .
|
|
ENTRYPOINT ["./zurg"]
|