-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
48 lines (37 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
43
44
45
46
47
48
# golang alpine
FROM golang:1.23.2-alpine AS builder
ARG TARGETARCH
ARG TARGETOS
ARG GIT_COMMIT=0
ARG GIT_BRANCH=master
ARG GIT_VERSION=undefined
LABEL maintainer="[email protected]"
RUN apk update \
&& apk add --no-cache \
gcc \
musl-dev \
&& update-ca-certificates
ENV GO111MODULE=on
ENV GOPATH=/
RUN mkdir /opt/nuts && cd /opt/nuts
COPY go.mod .
COPY go.sum .
RUN go mod download && go mod verify
COPY . .
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s -X 'github.com/nuts-foundation/nuts-node/core.GitCommit=${GIT_COMMIT}' -X 'github.com/nuts-foundation/nuts-node/core.GitBranch=${GIT_BRANCH}' -X 'github.com/nuts-foundation/nuts-node/core.GitVersion=${GIT_VERSION}'" -o /opt/nuts/nuts
# alpine
FROM alpine:3.20.3
RUN apk update \
&& apk add --no-cache \
tzdata \
curl \
&& update-ca-certificates
COPY --from=builder /opt/nuts/nuts /usr/bin/nuts
HEALTHCHECK --start-period=30s --timeout=5s --interval=10s \
CMD curl -f http://localhost:8081/status || exit 1
RUN adduser -D -H -u 18081 nuts-usr
USER 18081:18081
WORKDIR /nuts
EXPOSE 8080 8081 5555
ENTRYPOINT ["/usr/bin/nuts"]
CMD ["server"]