forked from HackRVA/memberdashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (27 loc) · 978 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
FROM golang:1.15 as backend-build
WORKDIR /membership
COPY . .
RUN go test -v ./...
ARG GIT_COMMIT="test"
RUN go mod vendor
RUN go build -o server -ldflags "-X memberserver/api.GitCommit=$GIT_COMMIT"
# create a file named Dockerfile
FROM node:latest as frontend-build
WORKDIR /app
COPY ui/package.json /app
# get rid of the ts buildinfo file
# we have to do this in the dockerfile because the ui filesystem is mounted
# i.e. file changes get written back to the repo and the tsbuildinfo file will conflict with itself
RUN if [ -f tsconfig.tsbuildinfo ]; then rm tsconfig.tsbuildinfo 2> /dev/null; fi
RUN npm install
COPY ./ui /app
# compile and bundle typescript
RUN npm run rollup
# copy from build environments
FROM node:latest
WORKDIR /app
COPY --from=frontend-build /app/dist ./ui/dist/
COPY --from=backend-build /membership/server .
COPY --from=backend-build /membership/templates ./templates
COPY docs/swaggerui/ ./docs/swaggerui/
ENTRYPOINT [ "./server" ]