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
|
|
|
|
|
ENV NODE_ENV=production
|
2021-04-29 09:59:25 +00:00
|
|
|
|
|
|
|
|
# set working directory
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# add `/app/node_modules/.bin` to $PATH
|
|
|
|
|
ENV PATH /app/node_modules/.bin:$PATH
|
|
|
|
|
|
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
|
|
|
|
2021-04-29 09:59:25 +00:00
|
|
|
# install app dependencies
|
2021-08-26 15:04:30 +00:00
|
|
|
COPY ./frontend/package.json ./frontend/package-lock.json ./
|
2021-07-12 09:15:42 +00:00
|
|
|
RUN npm install --only=production
|
2021-08-26 15:04:30 +00:00
|
|
|
COPY ./frontend .
|
2021-07-12 09:15:42 +00:00
|
|
|
RUN NODE_ENV=production npm run-script 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
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /app/build /var/www
|
|
|
|
|
|
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"]
|