From d4514873feb6f1951785b6d4a3880df7cda33306 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Thu, 28 Sep 2023 13:36:41 +0530 Subject: [PATCH 01/12] added docker file Signed-off-by: captain-Akshay --- .dockerignore | 3 +++ Dockerfile | 24 ++++++++++++++++++++++++ Dockerfile.dev | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Dockerfile.dev diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000000..763c421c133d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.next +.github \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..4c28415b04b8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Production Docker file +FROM node:18-alpine as builder + +WORKDIR /async + +COPY package.json package-lock.json scripts ./ + +RUN npm ci + +COPY . . +RUN npm run build + +FROM node:18-alpine AS PRODUCTION_STAGE +WORKDIR /async + +COPY --from=builder /async/package*.json ./ +COPY --from=builder /async/scripts ./ +COPY --from=builder /async/.next ./.next +COPY --from=builder /async/public ./public +COPY --from=builder /async/node_modules ./node_modules + +ENV NODE_ENV=production +EXPOSE 3000 +CMD ["npm", "start"] \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000000..42acadda2471 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,19 @@ +# Development Docker file +FROM node:18-alpine as development + +WORKDIR /async + +# Install development dependencies +COPY package.json package-lock.json ./ +RUN npm install + +# Copy the rest of the application files +COPY . . + +# Expose the port for development (if needed) +EXPOSE 3000 + +# Set environment variables for development (optional) +ENV NODE_ENV=development + +CMD ["npm", "run", "dev"] From 842aa2ca2f5b2e4e4267af838ba3e105c29278f6 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Wed, 4 Oct 2023 17:10:03 +0530 Subject: [PATCH 02/12] added the instruction for running docker file in readme.md Signed-off-by: captain-Akshay --- README.md | 15 +++++++++++++++ entrypoint.sh | 4 ++++ entrypoint_production.sh | 4 ++++ 3 files changed, 23 insertions(+) create mode 100755 entrypoint.sh create mode 100755 entrypoint_production.sh diff --git a/README.md b/README.md index a2a342939251..09d41500a094 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,21 @@ npm run build Generated files of the website go to the `.next` folder. +### Running the Docker image + +To run the Docker image, simply run the following command: + +### Steps to start server + +- `cd` into the repo +- run command `./entrypoint.sh` +- Visit localhost:3000 and the website should be live + +### Steps to shutdown this Docker Container + +- run `docker ps` get the list of containers running +- take the `container-id` and use the code `docker stop ` + ## Case studies ### Overview diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 000000000000..3d0f379e8779 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Step 1: Build the Docker image +docker build -t async_image -f Dockerfile.dev . && docker run -d -p 3000:3000 async_image \ No newline at end of file diff --git a/entrypoint_production.sh b/entrypoint_production.sh new file mode 100755 index 000000000000..22dddc655858 --- /dev/null +++ b/entrypoint_production.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Step 1: Build the Docker image +docker build -t async_prod -f Dockerfile . && docker run -d -p 3000:3000 async_prod \ No newline at end of file From 4ad8f160e1f727f40d344dd653cf73dc12d46949 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Wed, 4 Oct 2023 17:47:17 +0530 Subject: [PATCH 03/12] added the section for windows user Signed-off-by: captain-Akshay --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 09d41500a094..aee76539517c 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,10 @@ To run the Docker image, simply run the following command: - run command `./entrypoint.sh` - Visit localhost:3000 and the website should be live +### For Windows +- `cd` into the repo +- run the command one by one `docker build -t async_image -f Dockerfile.dev .` & `docker run -d -p 3000:3000 async_image` + ### Steps to shutdown this Docker Container - run `docker ps` get the list of containers running From 5bc245a2c873e4321680c49d7c2f2d2a7772e3b5 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Mon, 9 Oct 2023 12:28:15 +0530 Subject: [PATCH 04/12] modified the readme and docker file Signed-off-by: captain-Akshay --- Dockerfile | 27 +++++++++++---------------- Dockerfile.dev | 19 ------------------- README.md | 4 ++-- entrypoint.sh | 4 ---- entrypoint_production.sh | 4 ---- 5 files changed, 13 insertions(+), 45 deletions(-) delete mode 100644 Dockerfile.dev delete mode 100755 entrypoint.sh delete mode 100755 entrypoint_production.sh diff --git a/Dockerfile b/Dockerfile index 4c28415b04b8..42acadda2471 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,19 @@ -# Production Docker file -FROM node:18-alpine as builder +# Development Docker file +FROM node:18-alpine as development WORKDIR /async -COPY package.json package-lock.json scripts ./ - -RUN npm ci +# Install development dependencies +COPY package.json package-lock.json ./ +RUN npm install +# Copy the rest of the application files COPY . . -RUN npm run build -FROM node:18-alpine AS PRODUCTION_STAGE -WORKDIR /async +# Expose the port for development (if needed) +EXPOSE 3000 -COPY --from=builder /async/package*.json ./ -COPY --from=builder /async/scripts ./ -COPY --from=builder /async/.next ./.next -COPY --from=builder /async/public ./public -COPY --from=builder /async/node_modules ./node_modules +# Set environment variables for development (optional) +ENV NODE_ENV=development -ENV NODE_ENV=production -EXPOSE 3000 -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "run", "dev"] diff --git a/Dockerfile.dev b/Dockerfile.dev deleted file mode 100644 index 42acadda2471..000000000000 --- a/Dockerfile.dev +++ /dev/null @@ -1,19 +0,0 @@ -# Development Docker file -FROM node:18-alpine as development - -WORKDIR /async - -# Install development dependencies -COPY package.json package-lock.json ./ -RUN npm install - -# Copy the rest of the application files -COPY . . - -# Expose the port for development (if needed) -EXPOSE 3000 - -# Set environment variables for development (optional) -ENV NODE_ENV=development - -CMD ["npm", "run", "dev"] diff --git a/README.md b/README.md index aee76539517c..eb459d4924ca 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,12 @@ To run the Docker image, simply run the following command: ### Steps to start server - `cd` into the repo -- run command `./entrypoint.sh` +- run the following command `docker build -t async_image -f Dockerfile . && docker run -d -p 3000:3000 async_image` - Visit localhost:3000 and the website should be live ### For Windows - `cd` into the repo -- run the command one by one `docker build -t async_image -f Dockerfile.dev .` & `docker run -d -p 3000:3000 async_image` +- run the command one by one `docker build -t async_image -f Dockerfile.dev .` then `docker run -d -p 3000:3000 async_image` ### Steps to shutdown this Docker Container diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100755 index 3d0f379e8779..000000000000 --- a/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Step 1: Build the Docker image -docker build -t async_image -f Dockerfile.dev . && docker run -d -p 3000:3000 async_image \ No newline at end of file diff --git a/entrypoint_production.sh b/entrypoint_production.sh deleted file mode 100755 index 22dddc655858..000000000000 --- a/entrypoint_production.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Step 1: Build the Docker image -docker build -t async_prod -f Dockerfile . && docker run -d -p 3000:3000 async_prod \ No newline at end of file From b03bacb1bb1c53e9cdc62ce4c687e981ef238ff9 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Mon, 9 Oct 2023 16:02:14 +0530 Subject: [PATCH 05/12] modified the readme and docker file Signed-off-by: captain-Akshay --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb459d4924ca..e4eaf8af89ed 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,22 @@ To run the Docker image, simply run the following command: ### Steps to start server - `cd` into the repo -- run the following command `docker build -t async_image -f Dockerfile . && docker run -d -p 3000:3000 async_image` +- run the following command `docker build -t async-website -f Dockerfile . && docker run -d -p 3000:3000 async-website` - Visit localhost:3000 and the website should be live -### For Windows -- `cd` into the repo -- run the command one by one `docker build -t async_image -f Dockerfile.dev .` then `docker run -d -p 3000:3000 async_image` +#### To run a Docker container from the image, mapping the local fork of the repo to the container, run the following command: + +`docker run -d -v "$PWD":/async -p 3000:3000 async-website` + +You can also develop your application in your IDE and make changes to the code. Whenever you make a change, rebuild the Docker image and restart the Docker container. The changes will be reflected in your website. + +#### To rebuild the Docker image, run the following command: + +`docker build -t async-website .` + +#### To restart the Docker container, run the following command: + +`docker restart async-website` ### Steps to shutdown this Docker Container From 13572f8de0d7d53840a05f0c07786b4cf2574586 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Mon, 9 Oct 2023 16:05:12 +0530 Subject: [PATCH 06/12] modified the readme added local development section Signed-off-by: captain-Akshay --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e4eaf8af89ed..e84a0d14558e 100644 --- a/README.md +++ b/README.md @@ -105,11 +105,12 @@ To run the Docker image, simply run the following command: - `cd` into the repo - run the following command `docker build -t async-website -f Dockerfile . && docker run -d -p 3000:3000 async-website` -- Visit localhost:3000 and the website should be live +- Visit `localhost:3000` and the website should be live #### To run a Docker container from the image, mapping the local fork of the repo to the container, run the following command: - -`docker run -d -v "$PWD":/async -p 3000:3000 async-website` +```bash +docker run -d -v "$PWD":/async -p 3000:3000 async-website +``` You can also develop your application in your IDE and make changes to the code. Whenever you make a change, rebuild the Docker image and restart the Docker container. The changes will be reflected in your website. @@ -121,7 +122,7 @@ You can also develop your application in your IDE and make changes to the code. `docker restart async-website` -### Steps to shutdown this Docker Container +### Steps to shutdown the Docker Container - run `docker ps` get the list of containers running - take the `container-id` and use the code `docker stop ` From 0a008b8f8d03d837e1843f7ec3ca5d4c31e21617 Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Fri, 13 Oct 2023 00:14:42 +0530 Subject: [PATCH 07/12] refactored readme.md Signed-off-by: captain-Akshay --- README.md | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index e84a0d14558e..7208e3d4cedf 100644 --- a/README.md +++ b/README.md @@ -97,36 +97,28 @@ npm run build Generated files of the website go to the `.next` folder. -### Running the Docker image - -To run the Docker image, simply run the following command: - -### Steps to start server - -- `cd` into the repo -- run the following command `docker build -t async-website -f Dockerfile . && docker run -d -p 3000:3000 async-website` -- Visit `localhost:3000` and the website should be live - -#### To run a Docker container from the image, mapping the local fork of the repo to the container, run the following command: +### Run locally using Docker +Prerequisites: +- Docker installed + +#### Steps: +1. Build the Docker image: + ```bash + docker build -t asyncapi-website -f Dockerfile .` + ``` +2. Start the container: + ```bash + docker run -d -p 3000:3000 asyncapi-website + ``` +##### Note: To run a Docker container from the image, mapping the local fork of the repo to the container, run the following command (build the image first!) ```bash -docker run -d -v "$PWD":/async -p 3000:3000 async-website +docker run -d -v "$PWD":/async -p 3000:3000 asyncapi-website ``` -You can also develop your application in your IDE and make changes to the code. Whenever you make a change, rebuild the Docker image and restart the Docker container. The changes will be reflected in your website. - -#### To rebuild the Docker image, run the following command: - -`docker build -t async-website .` - -#### To restart the Docker container, run the following command: - -`docker restart async-website` - -### Steps to shutdown the Docker Container - -- run `docker ps` get the list of containers running -- take the `container-id` and use the code `docker stop ` - +##### To shutdown the Docker container: +```bash +docker run --rm +``` ## Case studies ### Overview From 4c81ce0f4b1384522ae290bb22e7268aa1404dc1 Mon Sep 17 00:00:00 2001 From: Akshay Sharma <59491379+captain-Akshay@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:35:33 +0530 Subject: [PATCH 08/12] Update README.md Co-authored-by: Lukasz Gornicki --- README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7208e3d4cedf..23537d4dc656 100644 --- a/README.md +++ b/README.md @@ -108,17 +108,12 @@ Prerequisites: ``` 2. Start the container: ```bash - docker run -d -p 3000:3000 asyncapi-website + docker run --rm -it -v "$PWD":/async -p 3000:3000 asyncapi-website ``` -##### Note: To run a Docker container from the image, mapping the local fork of the repo to the container, run the following command (build the image first!) -```bash -docker run -d -v "$PWD":/async -p 3000:3000 asyncapi-website -``` -##### To shutdown the Docker container: -```bash -docker run --rm -``` +Now you're running AsyncAPI website in a development mode. Container is mapped with your local copy of the website. Whenever you make changes to the code, the website will refresh and changes visible in localhost:3000. + + ## Case studies ### Overview From 69371570ec6bf7689213b4a0e92c27f3a940c45a Mon Sep 17 00:00:00 2001 From: Akshay Sharma <59491379+captain-Akshay@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:35:44 +0530 Subject: [PATCH 09/12] Update README.md Co-authored-by: Lukasz Gornicki --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23537d4dc656..a4bfe2dfe02a 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Prerequisites: #### Steps: 1. Build the Docker image: ```bash - docker build -t asyncapi-website -f Dockerfile .` + docker build -t asyncapi-website .` ``` 2. Start the container: ```bash From ecab08d259c94e1c613615bb62c63b8860efc83f Mon Sep 17 00:00:00 2001 From: Akshay Sharma <59491379+captain-Akshay@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:36:02 +0530 Subject: [PATCH 10/12] Update README.md Co-authored-by: Lukasz Gornicki --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4bfe2dfe02a..7f687addb4ee 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,10 @@ npm run build Generated files of the website go to the `.next` folder. ### Run locally using Docker -Prerequisites: -- Docker installed + +#### Prerequisites: + +- [install Docker](https://docs.docker.com/get-docker/) #### Steps: 1. Build the Docker image: From bb2bf631fe655542d2467ac2e3de2e20dc0fc2eb Mon Sep 17 00:00:00 2001 From: Akshay Sharma <59491379+captain-Akshay@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:36:19 +0530 Subject: [PATCH 11/12] Update README.md Co-authored-by: Lukasz Gornicki --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7f687addb4ee..0430958a97fe 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,9 @@ Generated files of the website go to the `.next` folder. - [install Docker](https://docs.docker.com/get-docker/) + +After cloning repository to your local, perform the following steps from the root of the repository. + #### Steps: 1. Build the Docker image: ```bash From e6596d3fc4045fa43ff7b3c7ae43382bef5cae0e Mon Sep 17 00:00:00 2001 From: captain-Akshay Date: Fri, 27 Oct 2023 16:40:44 +0530 Subject: [PATCH 12/12] changes to docker file Signed-off-by: captain-Akshay --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 42acadda2471..f0d69e54df02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Development Docker file -FROM node:18-alpine as development +FROM node:18-alpine WORKDIR /async