-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (50 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
49
50
51
52
53
54
55
56
57
58
59
60
#
# Build frontend
#
FROM node:lts-alpine as frontend-builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./web/src ./web/src
COPY ./*.config.js .
RUN npm run dist
#
# Build backend
#
FROM golang:1.21.4-alpine as backend-builder
ARG TARGETARCH
ARG TARGETOS
LABEL maintainer="wout.slakhorst@nuts.nl"
RUN apk update \
&& update-ca-certificates
ENV GO111MODULE on
ENV GOPATH /
RUN mkdir /app && cd /app
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download && go mod verify
COPY . .
COPY --from=frontend-builder /app/web/dist /app/web/dist
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o /app/nuts-monitor
#
# Runtime
#
FROM alpine:3.18
RUN apk update \
&& apk add --no-cache \
tzdata \
curl \
&& update-ca-certificates
RUN mkdir /app && cd /app
WORKDIR /app
RUN apk update \
&& apk add --no-cache \
tzdata \
curl
COPY --from=backend-builder /app/nuts-monitor .
HEALTHCHECK --start-period=5s --timeout=5s --interval=10s \
CMD curl -f http://localhost:1313/health || exit 1
EXPOSE 1313
ENTRYPOINT ["/app/nuts-monitor"]
CMD ["--configfile","/app/server.config.yaml"]