mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
tz, docker
This commit is contained in:
+20
-12
@@ -1,25 +1,33 @@
|
||||
FROM golang:1.25.6-alpine AS builder
|
||||
|
||||
RUN apk update && apk add --no-cache git ca-certificates tzdata
|
||||
|
||||
RUN addgroup -S -g 10001 appgroup && \
|
||||
adduser -S -u 10001 -G appgroup appuser
|
||||
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN go build -ldflags="-s -w" -o ipinfo .
|
||||
RUN go build -ldflags="-s -w" -o healthcheck ./healthcheck/healthcheck.go
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache tzdata
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o ipinfo .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o healthcheck ./healthcheck/healthcheck.go
|
||||
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
WORKDIR /staging
|
||||
RUN cp /build/ipinfo . && \
|
||||
cp /build/healthcheck/healthcheck .
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
COPY --from=builder --chown=10001:10001 /staging /app
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/ipinfo .
|
||||
COPY --from=builder /build/healthcheck .
|
||||
|
||||
RUN chown -R appuser:appgroup /app
|
||||
|
||||
USER appuser
|
||||
|
||||
ENV GEOIPUPDATE_EDITION_IDS="GeoLite2-City GeoLite2-ASN"
|
||||
USER 10001
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD ["./healthcheck"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user