Skip to content

Commit

Permalink
add installation via docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeshkhadka committed Jun 21, 2024
1 parent cfb4bcf commit 093ba6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM node:18.17.1-alpine
WORKDIR /app
COPY package*.json .
COPY package*.json ./
RUN npm install
COPY . .
COPY . ./
EXPOSE 3001
EXPOSE 3000
RUN npx prisma generate
RUN npm install -g nodemon
RUN chmod +x ./startserver.sh
CMD ["npm", "run","dev"]
CMD ["sh","./startserver.sh"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,21 @@ npm run dev
```
***Make sure you have your database running before staring the server***

### Using docker

Below is example how you can use docker with database within same network:
Set DATABASE_URL environment variable within .env file as below:
`DATABASE_URL=postgresql://postgres:<POSTGRES_PASSWORD>@roommates:5432/roommates`
*** You can skip setting up docker network postgresql container if you are using external databse***
```bash
sudo docker run -d \
--name roommates \
-e POSTGRES_PASSWORD=PASSWORD \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ~/.docker/volumes/postgres:/var/lib/postgresql/data \
-p 5432:5432 --network roommates_network postgres

docker run -p 3000:3000 --network roommates_network --env-file ./.env sandeshkhadka/roommates-backend:latest
```
## Docs: Refer to [wiki](https://github.com/sandeshkhadka/RooMates-backend/wiki) for documentation on api and routes

0 comments on commit 093ba6c

Please sign in to comment.