-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (30 loc) · 913 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
# -----------------------------------------------------
# Build container for compiling the Golang application
# -----------------------------------------------------
FROM golang:alpine AS GoBuilder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /build
COPY . .
RUN go mod download
RUN go build -o web cmd/web.go
# -----------------------------------------------------
# Build container for generating frontend assets
# -----------------------------------------------------
FROM node:current as FrontendBuilder
RUN mkdir -p /app
COPY ./frontend /app
WORKDIR /app
RUN npm install
RUN npm run build
# -----------------------------------------------------
# Final container
# -----------------------------------------------------
FROM scratch
COPY --from=GoBuilder /build/web /
COPY --from=FrontendBuilder /app/dist /public
WORKDIR /
EXPOSE 3000
ENTRYPOINT ["/web"]