-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
47 lines (35 loc) · 820 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
## FrontEnd Build
FROM node:10.19.0 as web
WORKDIR /web
COPY web .
RUN yarn
RUN yarn build
# generate server build
FROM golang:1.15.0-alpine as builder
WORKDIR /go/src/app
COPY . .
RUN apk add --no-cache make
RUN apk add git
RUN go get -d -v ./...
RUN go install -v ./...
RUN ls /go/bin
## Final Build
FROM alpine:3.7
# add ca-certificates in case you need them
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
# set working directory
WORKDIR /app
# copy the binary from builder
COPY --from=builder /go/bin/short .
# copy config files
COPY configs ./configs/
# copy seoData
COPY pkg/web/SEOData.json ./pkg/web/
# copy web files
COPY --from=web web/dist ./web/dist
# copy index.html
COPY --from=web web/index.html ./web/index.html
# run the binary
EXPOSE 1234
EXPOSE 80
CMD ["/app/short"]