-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (30 loc) · 1.16 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
34
35
36
37
38
39
40
41
42
# https://hub.docker.com/_/golang
FROM golang:1.22-bullseye AS build
ARG BUILD_VERSION=v1.0.0-develop
# Ensure ca-certificates are up to date
RUN update-ca-certificates
# Set the current Working Directory inside the container
RUN mkdir /scratch
WORKDIR /scratch
# Prepare the folder where we are putting all the files
RUN mkdir /app
# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . .
# Download go modules
RUN go mod download
RUN go mod verify
# Build the binary
RUN go build -o /app/inx-validator -a -ldflags="-w -s -X=github.com/iotaledger/inx-validator/components/app.Version=${BUILD_VERSION}"
# Copy the assets
COPY ./config_defaults.json /app/config.json
############################
# Image
############################
# https://console.cloud.google.com/gcr/images/distroless/global/cc-debian12
# using distroless cc "nonroot" image, which includes everything in the base image (glibc, libssl and openssl)
FROM gcr.io/distroless/cc-debian12:nonroot
# Copy the app dir into distroless image
COPY --chown=nonroot:nonroot --from=build /app /app
WORKDIR /app
USER nonroot
ENTRYPOINT ["/app/inx-validator"]