Files
zurg/Dockerfile
Ben Sarmiento a7d7c4ae0d Add healthcheck
2023-11-07 10:25:19 +01:00

29 lines
700 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 .
RUN apk add --no-cache fuse3
# Healthcheck to verify that port 9999 is available to accept connections
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD nc -z localhost 9999 || exit 1
ENTRYPOINT ["./zurg"]