Skip to content

Commit

Permalink
distroless nonroot image
Browse files Browse the repository at this point in the history
  • Loading branch information
sholdee committed Jul 9, 2024
1 parent 1ee4c50 commit 180a08c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ COPY . ./
# Build the application with static linking
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags="-s -w" -o adguard-exporter .

# Create a scratch image
FROM scratch
# Use distroless as the base image
FROM gcr.io/distroless/static-debian12:nonroot

WORKDIR /app

Expand All @@ -30,5 +30,8 @@ ENV LOG_FILE_PATH=/opt/adguardhome/work/data/querylog.json
ENV METRICS_PORT=8000
ENV LOG_LEVEL=INFO

# Use the nonroot user
USER nonroot:nonroot

# Run the exporter
CMD ["./adguard-exporter"]
CMD ["./adguard-exporter"]

0 comments on commit 180a08c

Please sign in to comment.