diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f4b92806 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +.next +.git +.env +Dockerfile +docker-compose.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..29c671d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +#Creates a layer from node:alpine image. +# FROM chub.cloud.gov.in/mit6c0-ogd/node-16:nic_server +FROM node:alpine + + +# RUN echo 'deb http://deb.debian.org/debian stretch main' >> apk update \ +# apk add curl git nano wget screen vim + +#Creates directories +RUN mkdir -p /usr/src/app + +# env + +#Sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, and ADD commands +WORKDIR /usr/src/app + +##Copy new files or directories into the filesystem of the container +COPY . /usr/src/app + +#Execute commands in a new layer on top of the current image and commit the results +RUN npm install -- +# RUN npm run build + +# Expose port 3000 to host +EXPOSE 3000 + +#Allows you to configure a container that will run as an executable +CMD npm run build && npm start diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..ad3a993c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + + next_app: + build: + context: . + dockerfile: Dockerfile + container_name: next-js-app + env_file: + - .env.local + ports: + - 3000:3000 + # stdin_open: true + # restart: unless-stopped + \ No newline at end of file