28 lines
648 B
Docker
28 lines
648 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=builder /app/zurg .
|
|
RUN apk add --no-cache fuse3 netcat-openbsd
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
CMD nc -z localhost 9999 || exit 1
|
|
|
|
ENTRYPOINT ["./zurg"]
|