2021-04-29 09:59:25 +00:00
|
|
|
# pull official base image
|
2022-03-24 12:00:14 +00:00
|
|
|
FROM node:14.17.3-buster AS builder
|
2022-01-17 07:08:17 +00:00
|
|
|
|
|
|
|
|
RUN npm i -g npm@7.20.0
|
2021-04-29 09:59:25 +00:00
|
|
|
|
|
|
|
|
# set working directory
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2022-01-17 07:08:17 +00:00
|
|
|
COPY ./package.json ./package.json
|
2021-04-29 09:59:25 +00:00
|
|
|
|
2021-05-26 02:11:12 +00:00
|
|
|
# Fix for heap limit allocation issue
|
2021-11-20 01:25:54 +00:00
|
|
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
2021-05-26 02:11:12 +00:00
|
|
|
|
2022-01-17 07:08:17 +00:00
|
|
|
# Build plugins
|
|
|
|
|
COPY ./plugins/package.json ./plugins/package-lock.json ./plugins/
|
|
|
|
|
RUN npm --prefix plugins install
|
|
|
|
|
COPY ./plugins/ ./plugins/
|
2022-09-01 17:10:02 +00:00
|
|
|
RUN NODE_ENV=production npm --prefix plugins run build
|
2022-05-20 14:02:46 +00:00
|
|
|
RUN npm --prefix plugins prune --production
|
2021-04-29 09:59:25 +00:00
|
|
|
|
2022-01-17 07:08:17 +00:00
|
|
|
# Build frontend
|
|
|
|
|
COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
|
2022-09-01 17:10:02 +00:00
|
|
|
RUN npm --prefix frontend install
|
2022-01-17 07:08:17 +00:00
|
|
|
COPY ./frontend ./frontend
|
2022-09-05 15:36:11 +00:00
|
|
|
RUN SERVE_CLIENT=false npm --prefix frontend run build --production
|
2022-09-01 17:10:02 +00:00
|
|
|
RUN npm --prefix frontend prune --production
|
2021-04-29 09:59:25 +00:00
|
|
|
|
2021-07-12 09:15:42 +00:00
|
|
|
FROM openresty/openresty:1.19.9.1rc1-buster-fat
|
2021-05-26 02:11:12 +00:00
|
|
|
|
2021-07-12 09:15:42 +00:00
|
|
|
RUN apt-get update && apt-get -y install --no-install-recommends wget \
|
|
|
|
|
gnupg ca-certificates apt-utils curl luarocks \
|
|
|
|
|
make build-essential g++ gcc autoconf
|
2021-04-29 09:59:25 +00:00
|
|
|
|
2021-07-12 09:15:42 +00:00
|
|
|
RUN luarocks install lua-resty-auto-ssl
|
|
|
|
|
|
|
|
|
|
RUN mkdir /etc/resty-auto-ssl /var/log/openresty /var/www /etc/fallback-certs
|
|
|
|
|
|
2022-01-17 07:08:17 +00:00
|
|
|
COPY --from=builder /app/frontend/build /var/www
|
2021-07-12 09:15:42 +00:00
|
|
|
|
2021-08-26 15:04:30 +00:00
|
|
|
COPY ./frontend/config/nginx.conf.template /etc/openresty/nginx.conf.template
|
|
|
|
|
COPY ./frontend/config/entrypoint.sh /entrypoint.sh
|
2022-09-16 15:38:45 +00:00
|
|
|
|
|
|
|
|
RUN chgrp -R 0 /var/www && chmod -R g=u /var/www
|
2021-07-12 09:15:42 +00:00
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|