Skip to content

Commit

Permalink
Merge pull request #9 from Topsideboss2/main
Browse files Browse the repository at this point in the history
Dockerizing the web app
  • Loading branch information
muriukialex authored Feb 24, 2024
2 parents 708e307 + 90306af commit 88182b1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ pnpm dev
bun dev
```

If you are using Docker:

```bash
docker build -t <image-name> .

docker run --name <container-name> -p 3000:3000 -d <image-name>
```

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.
Expand Down
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# run npm run dev through pm2
pm2 start npm -- run dev

# show logs
pm2 logs

0 comments on commit 88182b1

Please sign in to comment.