forked from nuts-foundation/nuts-demo-ehr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (41 loc) · 958 Bytes
/
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
#
# Build frontend
#
FROM node:15-alpine as frontend-builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY ./web ./web
COPY ./*.config.js .
RUN npm run build
#
# Build backend
#
FROM golang:1.17-alpine as backend-builder
ARG TARGETARCH
ARG TARGETOS
RUN apk update \
&& apk add --no-cache \
gcc \
musl-dev
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=1 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -o /app/nuts-demo-ehr
#
# Runtime
#
FROM alpine:3.15.0
RUN mkdir /app && cd /app
WORKDIR /app
COPY --from=backend-builder /app/nuts-demo-ehr .
HEALTHCHECK --start-period=5s --timeout=5s --interval=5s \
CMD wget --no-verbose --tries=1 --spider http://localhost:1304/status || exit 1
EXPOSE 1304
ENTRYPOINT ["/app/nuts-demo-ehr"]