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 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. diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..555270e --- /dev/null +++ b/entrypoint.sh @@ -0,0 +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