Files
argparser/assets/Dockerfile.alpine

39 lines
771 B
Docker

# Alpine-based image for debugging and shell access
FROM golang:1.23-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /build
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build \
-ldflags='-w -s' \
-o argparse-builder \
.
# Alpine base for shell access and debugging
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata && \
adduser -D -u 1000 argparse
WORKDIR /app
COPY --from=builder /build/argparse-builder .
# Change ownership
RUN chown argparse:argparse /app/argparse-builder
USER argparse
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
ENTRYPOINT ["/app/argparse-builder"]