2018-06-07 17:07:04 +08:00
|
|
|
# backend build (api server)
|
|
|
|
FROM golang:1.10.2-alpine AS api-build
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./api /go/src/commento/api
|
|
|
|
WORKDIR /go/src/commento/api
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2018-10-18 13:18:01 +08:00
|
|
|
RUN apk update && apk add bash make git curl
|
|
|
|
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2018-08-08 13:45:02 +08:00
|
|
|
RUN make prod -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# frontend build (html, js, css, images)
|
|
|
|
FROM node:10.3.0-alpine AS frontend-build
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./frontend /commento/frontend/
|
|
|
|
WORKDIR /commento/frontend/
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
RUN apk update && apk add bash make
|
2018-06-23 21:59:14 +08:00
|
|
|
RUN npm install -g html-minifier@3.5.7 uglify-js@3.4.1 sass@1.5.1
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2018-08-08 13:45:02 +08:00
|
|
|
RUN make prod -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# templates build
|
|
|
|
FROM alpine:3.7 AS templates-build
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./templates /commento/templates
|
|
|
|
WORKDIR /commento/templates
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
RUN apk update && apk add bash make
|
|
|
|
|
2018-08-08 13:45:02 +08:00
|
|
|
RUN make prod -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# db build
|
|
|
|
FROM alpine:3.7 AS db-build
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./db /commento/db
|
|
|
|
WORKDIR /commento/db
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
RUN apk update && apk add bash make
|
|
|
|
|
2018-08-08 13:45:02 +08:00
|
|
|
RUN make prod -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# final image
|
|
|
|
FROM alpine:3.7
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
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/
|
2019-02-19 07:27:44 +08:00
|
|
|
COPY --from=frontend-build /commento/frontend/build/prod/fonts/* /commento/fonts/
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY --from=templates-build /commento/templates/build/prod/templates/ /commento/templates/
|
|
|
|
COPY --from=db-build /commento/db/build/prod/db/ /commento/db/
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2018-08-08 15:40:18 +08:00
|
|
|
RUN apk update && apk add ca-certificates --no-cache
|
|
|
|
|
2018-06-07 17:07:04 +08:00
|
|
|
EXPOSE 8080
|
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
WORKDIR /commento/
|
2018-06-10 06:54:14 +08:00
|
|
|
|
|
|
|
ENV COMMENTO_BIND_ADDRESS="0.0.0.0"
|
2018-12-29 01:41:45 +08:00
|
|
|
ENTRYPOINT ["/commento/commento"]
|