From 59fc94b75186223067e70f92a8731dc402234c20 Mon Sep 17 00:00:00 2001 From: "James@SCF-GC" Date: Wed, 8 Jun 2022 19:57:49 +0200 Subject: [PATCH] updated dockerfile --- .dockergnore | 8 ++++++++ Dockerfile | 30 ++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 .dockergnore diff --git a/.dockergnore b/.dockergnore new file mode 100644 index 0000000..6c774ce --- /dev/null +++ b/.dockergnore @@ -0,0 +1,8 @@ +.git +.editorconfig +/.vscode/* +/node_modules +/e2e +/docs +.gitignore +*.zip \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 47143f2..840bd33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,21 @@ -#FROM - Image to start building on. -FROM ubuntu:14.04 +# STEP 1: +# Name the node stage "builder" +FROM node:latest AS builder +# Set working directory +WORKDIR /app +# Copy all files from current directory to working dir in image +COPY . . +# install node modules and build assets +RUN npm i && npm run build -#MAINTAINER - Identifies the maintainer of the dockerfile. -MAINTAINER jesse.isler@gmail.com - -#RUN - Runs a command in the container -RUN echo "Hello world" > /tmp/hello_world.txt - -#CMD - Identifies the command that should be used by default when running the image as a container. -CMD ["cat", "/tmp/hello_world.txt"] \ No newline at end of file +# STEP 2: +# nginx state for serving content +FROM nginx:alpine +# Set working directory to nginx asset directory +WORKDIR /usr/share/nginx/html +# Remove default nginx static assets +RUN rm -rf ./* +# Copy static assets from builder stage +COPY --from=builder /app/dist/schedulord-backend . +# Containers run nginx with global directives and daemon off +ENTRYPOINT ["nginx", "-g", "daemon off;"] \ No newline at end of file