-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
33 lines (23 loc) · 1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Step 1: Use the official Golang image as the build environment.
# This image includes all the tools needed to compile Go applications.
FROM golang:1.23 as builder
# Version will be passed as a part of the build.
ARG VERSION=dev
# Set the Current Working Directory inside the container.
WORKDIR /app
# Copy the local package files to the container's workspace.
COPY . .
# Build the Go app for a Linux system.
RUN VERSION=${VERSION} make build
# Step 2: Use a builder image to get the latest certificates.
FROM alpine:latest as certs
# Download the latest CA certificates
RUN apk --update add ca-certificates
# Step 3: Use a Docker multi-stage build to create a lean production image.
# Start from a scratch (empty) image to keep the image size small.
FROM scratch
# Copy the binary from the builder stage to the production image.
COPY --from=builder /app/godnsbench /
# Copy the CA certificates from the certs image.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/godnsbench"]