-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerize React App - Create Docker Image
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,24 @@ WORKDIR /usr/src/app | |
# add `/usr/src/app/node_modules/.bin` to $PATH | ||
ENV PATH /usr/src/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 | ||
RUN npm install [email protected] -g --silent | ||
RUN npm install pushstate-server -g --silent | ||
|
||
# add app | ||
ADD . /usr/src/app | ||
|
||
# build react app | ||
RUN npm run build | ||
|
||
# start app | ||
CMD ["npm", "start"] | ||
CMD ["pushstate-server", "build"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters