From 01bb6ed79642e74c677e15f119ddb18f4b695d4f Mon Sep 17 00:00:00 2001 From: Ahmad Sghaier Date: Mon, 28 Jun 2021 21:04:40 -0400 Subject: [PATCH] Add dockerfile to build docker image of prod app --- .dockerignore | 4 ++++ Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bfbdc1e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.git +.editorconfig +.gitignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..60d970b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +# Stage 1: Compile and Build the app + +# Node veersion +FROM node:14.15.1 as build + +# update + +RUN apt-get update +RUN apt-get -y install curl gnupg +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get -y install nodejs + +# Set the working directory +WORKDIR /usr/local/app + +# Add the source code to app +COPY ./ /usr/local/app/ + +WORKDIR js +# Install all the dependencies +RUN yarn install +RUN yarn bootstrap + +# HERE ADD YOUR STORE WALLET ADDRESS +ENV REACT_APP_STORE_OWNER_ADDRESS_ADDRESS="" + +# Generate the build of the application +ENV GENERATE_SOURCEMAP=false +RUN yarn build + +# Stage 2: Serve app with nginx server + +# Use official nginx image as the base image +FROM nginx:latest + +# Copy the build output to replace the default nginx contents. +COPY --from=build /usr/local/app/js/build/web /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 \ No newline at end of file