Skip to content

Instantly share code, notes, and snippets.

@mikaelhadler
Last active March 29, 2019 16:13
Show Gist options
  • Save mikaelhadler/9d4ce86ad8d30d0eb31a7ca2df3334da to your computer and use it in GitHub Desktop.
Save mikaelhadler/9d4ce86ad8d30d0eb31a7ca2df3334da to your computer and use it in GitHub Desktop.
Production example
#==================== Building Stage ================================================
# Create the image based on the official Node 8.9.0 image from Dockerhub
FROM node:9
# Create a directory where our app will be placed. This might not be necessary
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 app
COPY . /app
# Expose the port the app runs in
EXPOSE 4200
#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/dist/ /usr/share/nginx/html
COPY ./nginx-app.conf /etc/nginx/conf.d/default.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment