From 5981234eb6a50afd1df43e3baea133114b1c08f1 Mon Sep 17 00:00:00 2001 From: Mark Kibara Date: Mon, 19 Feb 2024 17:12:04 +0300 Subject: [PATCH 1/4] Add entrypoint.sh --- entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..a9800eb --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +pm2 start npm -- run dev +pm2 logs \ No newline at end of file From f901a70df50e195448830dc0c6ef6e29f04671b3 Mon Sep 17 00:00:00 2001 From: Mark Kibara Date: Mon, 19 Feb 2024 17:12:18 +0300 Subject: [PATCH 2/4] Add Dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..88fc387 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Choose the Image which has Node installed already +FROM node:18.17-alpine + +# make the 'app' folder the current working directory +WORKDIR /app + +# copy both 'package.json' and 'package-lock.json' (if available) +COPY package*.json ./ + +# install project dependencies +RUN npm install + +RUN npm install pm2@latest -g + +# copy project files and folders to the current working directory +COPY . . + +# specifies that the container will listen on port 3000 +EXPOSE 3000 + +# specifies the command to run when the Docker image is started +ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file From 08bc16e392745811251c6b63d1522161c9c5a1f5 Mon Sep 17 00:00:00 2001 From: Mark Kibara Date: Mon, 19 Feb 2024 17:13:04 +0300 Subject: [PATCH 3/4] Add comments to entrypoint.sh --- entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index a9800eb..555270e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,7 @@ #!/bin/sh +# run npm run dev through pm2 pm2 start npm -- run dev + +# show logs pm2 logs \ No newline at end of file From 90306af65584f21c6ec1a9e59ae4709f48c60f73 Mon Sep 17 00:00:00 2001 From: Mark Kibara Date: Mon, 19 Feb 2024 17:22:59 +0300 Subject: [PATCH 4/4] Add Docker commands --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c403366..c04f6b0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ pnpm dev bun dev ``` +If you are using Docker: + +```bash +docker build -t . + +docker run --name -p 3000:3000 -d +``` + Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.