Last active
January 24, 2021 15:18
-
-
Save pak11273/77b3b85f4ce570da08ab43d2843c483d to your computer and use it in GitHub Desktop.
Dockerfile Client (React)
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
FROM node:lts-alpine | |
# A directory inside the docker container | |
WORKDIR /usr/src/app | |
# Copies everything over to Docker environment | |
COPY ./client . | |
# Installs all node packages | |
RUN npm install | |
# Install serve globally | |
RUN npm i -g serve | |
# Just a peek inside the working directory | |
RUN ls -al | |
# build the app | |
RUN npm run build | |
# Alternative http server option | |
COPY ./client/nodeServer.ts build/nodeServer.js | |
# Uses port which is used by the actual application | |
EXPOSE 3000 | |
# Finally runs the application | |
CMD [ "npm", "run", "serve" ] | |
# If you are using nodeServer.js uncomment the next 2 lines | |
# WORKDIR /usr/src/app/build | |
# CMD ["node", "prod"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment