2018-06-07 22:09:51 +02:00
|
|
|
FROM node:8.11.1 as base
|
|
|
|
ENV APP_HOME=/usr/src/app \
|
|
|
|
TERM=xterm
|
|
|
|
RUN mkdir -p $APP_HOME
|
|
|
|
WORKDIR $APP_HOME
|
|
|
|
EXPOSE 8000
|
2018-08-10 23:11:04 +02:00
|
|
|
# EXPOSE 80
|
|
|
|
# EXPOSE 443
|
2018-08-13 22:40:51 +02:00
|
|
|
ARG API_URL
|
|
|
|
ARG S3_BUCKET
|
|
|
|
ARG AWS_REGION
|
|
|
|
ARG S3_BUCKET_URL_BASE
|
|
|
|
ARG FORCE_TO_HTTPS
|
|
|
|
|
|
|
|
ENV API_URL=$API_URL
|
|
|
|
ENV S3_BUCKET=$S3_BUCKET
|
|
|
|
ENV AWS_REGION=$AWS_REGION
|
|
|
|
ENV S3_BUCKET_URL_BASE=$S3_BUCKET_URL_BASE
|
|
|
|
ENV FORCE_TO_HTTPS=$FORCE_TO_HTTPS
|
2018-06-07 22:09:51 +02:00
|
|
|
|
|
|
|
FROM base as development
|
|
|
|
ENV NODE_ENV development
|
|
|
|
COPY package.json package-lock.json ./
|
|
|
|
RUN npm install
|
|
|
|
RUN npm rebuild node-sass
|
2018-06-15 22:51:42 +02:00
|
|
|
COPY .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js webpack.config.examples.js ./
|
2018-06-07 22:09:51 +02:00
|
|
|
COPY client ./client
|
|
|
|
COPY server ./server
|
|
|
|
CMD ["npm", "start"]
|
|
|
|
|
|
|
|
FROM development as build
|
|
|
|
ENV NODE_ENV production
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
FROM base as production
|
|
|
|
ENV NODE_ENV=production
|
2018-08-10 23:11:04 +02:00
|
|
|
COPY package.json package-lock.json index.js ./
|
2018-06-07 22:09:51 +02:00
|
|
|
RUN npm install --production
|
|
|
|
RUN npm rebuild node-sass
|
2018-08-10 23:11:04 +02:00
|
|
|
# RUN npm install pm2 -g
|
2018-06-20 05:01:04 +02:00
|
|
|
# RUN npm install local-ssl-proxy
|
2018-08-10 23:11:04 +02:00
|
|
|
# COPY index.js ecosystem.json ./
|
2018-06-07 22:09:51 +02:00
|
|
|
COPY --from=build /usr/src/app/dist ./dist
|
2018-06-20 00:22:18 +02:00
|
|
|
# for reg production
|
2018-08-10 23:11:04 +02:00
|
|
|
CMD ["npm", "run", "start:prod"]
|
|
|
|
# for production with pm2
|
|
|
|
# CMD ["pm2-runtime", "ecosystem.json"]
|
2018-06-20 00:22:18 +02:00
|
|
|
# for testing ssl locally
|
|
|
|
# CMD npm run ssl-proxy && pm2-runtime ecosystem.json
|