Skip to content

Instantly share code, notes, and snippets.

@orlando-c-h
Created February 26, 2018 15:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save orlando-c-h/5f2522808654a2bcf8d6e297799ef9e9 to your computer and use it in GitHub Desktop.
#==================== Building Stage ================================================
# Create the image based on the official Node 8.9.0 image from Dockerhub
FROM node:8.9.0 as node
# Create a directory where our app will be placed. This might not be necessary
RUN mkdir -p /to-do-app
# Change directory so that our commands run inside this new directory
WORKDIR /to-do-app
# Copy dependency definitions
COPY package.json /to-do-app
# Install dependencies using npm
RUN npm install
# Get all the code needed to run the app
COPY . /to-do-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 /to-do-app/dist/ /usr/share/nginx/html
COPY ./nginx-to-do-app.conf /etc/nginx/conf.d/default.conf
@captnAmericaa
Copy link

Hi Orlando

While running docker build using above docker file, I am getting an error on command - COPY --from=node /to-do-app/dist/ /usr/share/nginx/html

its complaining about directory not found. Exact error is
COPY failed: stat /mnt/sda1/var/lib/docker/aufs/mnt/440b6be48c3389db4bafa7790c9b8e8ed8ed3fe89ca73da46e2dbc2dd60ea14e/to-do-app/dist: no such file or directory

If you could help me in understand whats going wrong here.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment