2018-06-07 17:07:04 +08:00
|
|
|
# backend build (api server)
|
2020-09-05 07:05:37 +08:00
|
|
|
FROM golang:1.15-alpine AS api-build
|
2020-02-10 00:39:29 +08:00
|
|
|
RUN apk add --no-cache --update bash dep make git curl g++
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2020-07-19 08:23:28 +08:00
|
|
|
ARG RELEASE=prod
|
2019-06-06 12:40:17 +08:00
|
|
|
COPY ./api /go/src/commento/api/
|
2018-12-29 01:41:45 +08:00
|
|
|
WORKDIR /go/src/commento/api
|
2020-07-19 08:23:28 +08:00
|
|
|
RUN make ${RELEASE} -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# frontend build (html, js, css, images)
|
2020-09-05 07:05:37 +08:00
|
|
|
FROM node:12-alpine AS frontend-build
|
2020-02-10 00:39:29 +08:00
|
|
|
RUN apk add --no-cache --update bash make python2 g++
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2020-07-19 08:23:28 +08:00
|
|
|
ARG RELEASE=prod
|
2019-06-06 12:40:17 +08:00
|
|
|
COPY ./frontend /commento/frontend
|
2018-12-29 01:41:45 +08:00
|
|
|
WORKDIR /commento/frontend/
|
2020-07-19 08:23:28 +08:00
|
|
|
RUN make ${RELEASE} -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
2019-06-06 12:40:17 +08:00
|
|
|
# templates and db build
|
2020-09-05 07:05:37 +08:00
|
|
|
FROM alpine:3.13 AS templates-db-build
|
2019-06-06 12:40:17 +08:00
|
|
|
RUN apk add --no-cache --update bash make
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2020-07-19 08:23:28 +08:00
|
|
|
ARG RELEASE=prod
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./templates /commento/templates
|
|
|
|
WORKDIR /commento/templates
|
2020-07-19 08:23:28 +08:00
|
|
|
RUN make ${RELEASE} -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2018-12-29 01:41:45 +08:00
|
|
|
COPY ./db /commento/db
|
|
|
|
WORKDIR /commento/db
|
2020-07-19 08:23:28 +08:00
|
|
|
RUN make ${RELEASE} -j$(($(nproc) + 1))
|
2018-06-07 17:07:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
# final image
|
2020-09-05 07:05:37 +08:00
|
|
|
FROM alpine:3.13
|
2019-06-06 12:40:17 +08:00
|
|
|
RUN apk add --no-cache --update ca-certificates
|
2018-06-07 17:07:04 +08:00
|
|
|
|
2020-07-19 08:23:28 +08:00
|
|
|
ARG RELEASE=prod
|
|
|
|
|
|
|
|
COPY --from=api-build /go/src/commento/api/build/${RELEASE}/commento /commento/commento
|
|
|
|
COPY --from=frontend-build /commento/frontend/build/${RELEASE}/js /commento/js
|
|
|
|
COPY --from=frontend-build /commento/frontend/build/${RELEASE}/css /commento/css
|
|
|
|
COPY --from=frontend-build /commento/frontend/build/${RELEASE}/images /commento/images
|
|
|
|
COPY --from=frontend-build /commento/frontend/build/${RELEASE}/fonts /commento/fonts
|
|
|
|
COPY --from=frontend-build /commento/frontend/build/${RELEASE}/*.html /commento/
|
|
|
|
COPY --from=templates-db-build /commento/templates/build/${RELEASE}/templates /commento/templates/
|
|
|
|
COPY --from=templates-db-build /commento/db/build/${RELEASE}/db /commento/db/
|
2018-08-08 15:40:18 +08:00
|
|
|
|
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"]
|