Skip to content

Instantly share code, notes, and snippets.

@Marvinified
Last active January 21, 2019 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marvinified/ae245bdb4d58b1ee284750183f9f2998 to your computer and use it in GitHub Desktop.
Save Marvinified/ae245bdb4d58b1ee284750183f9f2998 to your computer and use it in GitHub Desktop.
#==================== Building Stage=======================#
# Create the image based on the official Node 10 image from Dockerhub
FROM node:10 as node
# Create a new directory
RUN mkdir -p /app
# Change directory so that our commands run inside this new directory
WORKDIR /app
# Copy dependency definitions
COPY package.json /app
# Install dependencies using npm
RUN npm install
# Get all the code needed to run the ap
COPY . /app
#Build the app
RUN npm run build
#==================== Setting up stage ====================#
# Create image based on the official nginx - Alpine image
FROM nginx:1.13.7-alpine
COPY --from=node /app/build /usr/share/nginx/html
# nginx.conf to configure nginx because of react routing
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment