-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (41 loc) · 1.71 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# backend build (api server)
FROM golang:1.10.2-alpine AS api-build
COPY ./api /go/src/commento/api
WORKDIR /go/src/commento/api
RUN apk update && apk add bash make git curl
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN make prod -j$(($(nproc) + 1))
# frontend build (html, js, css, images)
FROM node:10.3.0-alpine AS frontend-build
COPY ./frontend /commento/frontend/
WORKDIR /commento/frontend/
RUN apk update && apk add bash make
RUN make prod -j$(($(nproc) + 1))
# templates build
FROM alpine:3.7 AS templates-build
COPY ./templates /commento/templates
WORKDIR /commento/templates
RUN apk update && apk add bash make
RUN make prod -j$(($(nproc) + 1))
# db build
FROM alpine:3.7 AS db-build
COPY ./db /commento/db
WORKDIR /commento/db
RUN apk update && apk add bash make
RUN make prod -j$(($(nproc) + 1))
# final image
FROM alpine:3.7
COPY --from=api-build /go/src/commento/api/build/prod/commento /commento/commento
COPY --from=frontend-build /commento/frontend/build/prod/*.html /commento/
COPY --from=frontend-build /commento/frontend/build/prod/css/*.css /commento/css/
COPY --from=frontend-build /commento/frontend/build/prod/js/*.js /commento/js/
COPY --from=frontend-build /commento/frontend/build/prod/images/* /commento/images/
COPY --from=frontend-build /commento/frontend/build/prod/fonts/* /commento/fonts/
COPY --from=templates-build /commento/templates/build/prod/templates/ /commento/templates/
COPY --from=db-build /commento/db/build/prod/db/ /commento/db/
RUN apk update && apk add ca-certificates --no-cache
EXPOSE 8080
WORKDIR /commento/
ENV COMMENTO_BIND_ADDRESS="0.0.0.0"
ENTRYPOINT ["/commento/commento"]