Skip to content

Instantly share code, notes, and snippets.

@rasmar
Last active March 9, 2018 12:15
Show Gist options
  • Save rasmar/f862ebbe4eb19fa2b7d52b2e143ee03f to your computer and use it in GitHub Desktop.
Save rasmar/f862ebbe4eb19fa2b7d52b2e143ee03f to your computer and use it in GitHub Desktop.
E2E - starting dockerfile
## specify node version
FROM quay.io/netguru/ng-node:6 as builder # First 'FROM', as builder is used as reference below
## add necessary environments
ENV NODE_ENV staging # Set env var
## add code & build app
ADD . $APP_HOME # Copy / add external source to image's filesystem
RUN yarn install # Install all dependencies for frontend app
RUN yarn build # Compile frontend build
## Real app image
FROM nginx:alpine as app # Second 'FROM', now it's multi-stage build file
## Copy build/ folder to new image
COPY --from=builder /app/build /app/dist # Copy file from one image to another by reference - we will have to get rid of it
COPY nginx.conf /etc/nginx/nginx.conf # Copy nginx config to nginx directory
EXPOSE 3000 # Container will listen on this port at runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment