Commit 25efac0b authored by Arun Kumar's avatar Arun Kumar
Browse files

docker files updated !!

No related merge requests found
Showing with 9 additions and 36 deletions
+9 -36
#get the latest alpine image from node registry FROM node:lts as dependencies
FROM node:16-alpine AS build-stage
RUN npm i -g pnpm
#set the working directory
WORKDIR /app WORKDIR /app
COPY . ./
#copy the package and package lock files
#from local to container work directory /app
COPY package.json /app/
COPY package-lock.json /app/
#Run command npm install to install packages
RUN npm install RUN npm install
#copy all the folder contents from local to container
COPY . .
#specify env variables at runtime
ARG REACT_APP_ENKETO_URL
ARG REACT_APP_FORM_MANAGER_URL
ARG REACT_APP_HASURA_URL
ENV REACT_APP_ENKETO_URL $REACT_APP_ENKETO_URL
ENV REACT_APP_FORM_MANAGER_URL $REACT_APP_FORM_MANAGER_URL
ENV REACT_APP_HASURA_URL $REACT_APP_HASURA_URL
#create a react production build
RUN npm run build RUN npm run build
EXPOSE 3002
#get the latest alpine image from nginx registry CMD ["npm", "run", "start-prod"]
FROM nginx:alpine \ No newline at end of file
#we copy the output from first stage that is our react build
#into nginx html directory where it will serve our index file
COPY --from=build-stage /app/build/ /usr/share/nginx/html
\ No newline at end of file
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"start-prod": "serve -s build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
...@@ -44,6 +45,7 @@ ...@@ -44,6 +45,7 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"serve": "^14.2.0",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"react-icons": "^4.8.0", "react-icons": "^4.8.0",
"react-xml-parser": "^1.1.8", "react-xml-parser": "^1.1.8",
......
...@@ -3,5 +3,5 @@ WORKDIR /app ...@@ -3,5 +3,5 @@ WORKDIR /app
COPY . ./ COPY . ./
RUN npm install RUN npm install
RUN npm run build RUN npm run build
EXPOSE 3000 EXPOSE 3001
CMD ["npm", "run", "start-prod"] CMD ["npm", "run", "start"]
\ No newline at end of file \ No newline at end of file
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"serve": "^14.2.0",
"react-icons": "^4.8.0", "react-icons": "^4.8.0",
"tailwindcss": "^3.3.2" "tailwindcss": "^3.3.2"
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment