2021-04-29 09:59:25 +00:00
|
|
|
# pull official base image
|
2021-08-26 15:04:30 +00:00
|
|
|
FROM node:14.17.3-alpine 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/
|
|
|
|
|
RUN npm run build:plugins
|
2021-04-29 09:59:25 +00:00
|
|
|
|
2022-01-17 07:08:17 +00:00
|
|
|
# Build frontend
|
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
|
|
|
|
|
RUN npm --prefix frontend install --only=production
|
|
|
|
|
COPY ./frontend ./frontend
|
|
|
|
|
RUN npm --prefix frontend run build
|
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
|
2021-07-12 09:15:42 +00:00
|
|
|
ENTRYPOINT ["./entrypoint.sh"]
|