2018-01-10 22:36:31 +01:00
|
|
|
FROM node:latest
|
|
|
|
|
|
|
|
# set working directory
|
|
|
|
RUN mkdir /usr/src/app
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# add `/usr/src/app/node_modules/.bin` to $PATH
|
|
|
|
ENV PATH /app/node_modules/.bin:$PATH
|
|
|
|
|
|
|
|
# add environment variables
|
|
|
|
ARG REACT_APP_USERS_SERVICE_URL
|
|
|
|
ARG NODE_ENV
|
|
|
|
ENV NODE_ENV $NODE_ENV
|
|
|
|
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
|
|
|
|
|
|
|
|
# install and cache app dependencies
|
|
|
|
ADD package.json /usr/src/app/package.json
|
|
|
|
RUN npm install --silent
|
2018-01-13 21:06:08 +01:00
|
|
|
RUN npm install pushstate-server -g --silent
|
2018-01-10 22:36:31 +01:00
|
|
|
|
|
|
|
# add app
|
|
|
|
ADD . /usr/src/app/
|
|
|
|
|
2018-01-13 21:06:08 +01:00
|
|
|
# build react app
|
|
|
|
RUN npm run build
|
|
|
|
|
2018-01-10 22:36:31 +01:00
|
|
|
# start app
|
2018-01-13 21:06:08 +01:00
|
|
|
CMD ["pushstate-server", "build"]
|