-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Dockerfile.heroku
56 lines (43 loc) · 1.87 KB
/
Dockerfile.heroku
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
# vim: syntax=dockerfile
## Commento Dockerfile for running on Heroku
# 1. duplicate most of original docker image: https://gitlab.com/commento/commento/blob/master/Dockerfile
# backend build (api server)
FROM golang:1.15-alpine AS api-build
RUN apk add --no-cache --update bash make git curl
COPY ./api /go/src/commento/api/
WORKDIR /go/src/commento/api
ENV GO111MODULE=on
RUN make prod -j$(($(nproc) + 1))
# frontend build (html, js, css, images)
FROM node:12-alpine AS frontend-build
RUN apk add --no-cache --update bash make
COPY ./frontend /commento/frontend
WORKDIR /commento/frontend/
RUN make prod -j$(($(nproc) + 1))
# templates and db build
FROM alpine:3.12 AS templates-db-build
RUN apk add --no-cache --update bash make
COPY ./templates /commento/templates
WORKDIR /commento/templates
RUN make prod -j$(($(nproc) + 1))
COPY ./db /commento/db
WORKDIR /commento/db
RUN export COMMENTO_POSTGRES=$(DATABASE_URL) # our addition
RUN make prod -j$(($(nproc) + 1))
# final image
FROM alpine:3.12
RUN apk add --no-cache --update ca-certificates
COPY --from=api-build /go/src/commento/api/build/prod/commento /commento/commento
COPY --from=frontend-build /commento/frontend/build/prod/js /commento/js
COPY --from=frontend-build /commento/frontend/build/prod/css /commento/css
COPY --from=frontend-build /commento/frontend/build/prod/images /commento/images
COPY --from=frontend-build /commento/frontend/build/prod/fonts /commento/fonts
COPY --from=frontend-build /commento/frontend/build/prod/i18n /commento/i18n
COPY --from=frontend-build /commento/frontend/build/prod/*.html /commento/
COPY --from=templates-db-build /commento/templates/build/prod/templates /commento/templates/
COPY --from=templates-db-build /commento/db/build/prod/db /commento/db/
COPY ./run.sh /commento/
RUN chmod +x /commento/run.sh
WORKDIR /commento/
ENV COMMENTO_BIND_ADDRESS="0.0.0.0"
CMD ["sh", "/commento/run.sh"]