forked from fastenhealth/fasten-onprem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (38 loc) · 1.85 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
#########################################################################################################
# Frontend Build
#########################################################################################################
FROM node:18.9.0 as frontend-build
ARG FASTEN_ENV=sandbox
WORKDIR /usr/src/fastenhealth/frontend
COPY frontend/package.json frontend/yarn.lock ./
RUN yarn config set registry "https://registry.npmjs.org" \
&& yarn install --frozen-lockfile
COPY frontend/ ./
RUN yarn run build -- --configuration ${FASTEN_ENV} --output-path=../dist
#########################################################################################################
# Backend Build
#########################################################################################################
FROM golang:1.18 as backend-build
WORKDIR /go/src/github.com/fastenhealth/fastenhealth-onprem
COPY . .
RUN go mod vendor \
&& go install github.com/golang/mock/[email protected] \
&& go generate ./... \
&& go vet ./... \
&& go test ./...
RUN CGO_ENABLED=0 go build -o /go/bin/fasten ./backend/cmd/fasten/
# create folder structure
RUN mkdir -p /opt/fasten/db \
&& mkdir -p /opt/fasten/web \
&& mkdir -p /opt/fasten/config
#########################################################################################################
# Distribution Build
#########################################################################################################
FROM gcr.io/distroless/static-debian11
WORKDIR /opt/fasten/
COPY --from=backend-build /opt/fasten/ /opt/fasten/
COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/web
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
COPY LICENSE.md /opt/fasten/LICENSE.md
COPY config.yaml /opt/fasten/config/config.yaml
CMD ["/opt/fasten/fasten", "start", "--config", "/opt/fasten/config/config.yaml"]