Created
May 8, 2018 10:31
-
-
Save wawhal/297f97345a1dfa3d569787f096b83199 to your computer and use it in GitHub Desktop.
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
# Step 1: Pulls a simple ubuntu image with node 8 installed in it | |
FROM node:8 | |
# Set an environment variable PORT as 8080 | |
ENV PORT 8080 | |
# Step 2: Make a new directory called "app" | |
RUN mkdir /app | |
# Step 3: Copy the package.json file from your local directory and paste it inside the container, inside the app directory | |
COPY app/package.json /app/package.json | |
# Step 4: cd into the app directory and run npm install to install application dependencies | |
RUN cd /app && npm install | |
# Step 5: Install serve globally to be used to serve the app | |
RUN npm -g install serve | |
# Step 6: Add all source code into the app directory from your local app directory | |
ADD app /app/ | |
# Step 7: cd into the app directory and execute the npm run build command | |
RUN cd /app && npm run build | |
# Step 8: Set app as our current work directory | |
WORKDIR /app | |
# For serving the production build, uncomment line 31 and comment everything below it | |
# Step 9: Serve the app at port 8080 using the serve package | |
#CMD ["serve", "-s", "build", "-p", "8080"] | |
# Step 9: Hot reloading | |
# Comment line 28 and un-comment the next line to enable hot reloading: | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment