- Install Nodejs locally
- Clone the repository:
- using
git clone https://github.com/ghagevaibhav/week-27-docker-compose.git
- using
- Go into the directory
- using
cd week-27-docker-compose
- using
- Install dependencies using
npm install
- Setup db locally
- using
docker run --name docker-compose -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres
- Or get yourself a cloud database from neon.tech
- using
- Update the .env file with your database credentials
- Migrate the db and generate client
- using
npx prisma migrate dev && npx prisma generate
- using
- Start the application
- using
npm run dev
- using
- Install Docker locally
- Clone the repository:
- using
git clone https://github.com/ghagevaibhav/week-27-docker-compose.git
- using
- Go into the directory
- using
cd week-27-docker-compose
- using
- Create network
- using
docker network create docker-compose
- using
- Start postgres
- using
docker run --network docker-compose --name docker-compose -e POSTGRES_PASSWORD=mysecretpassword -d -p 5433:5432 postgres
- using
- Build the docker image
- using
docker build --network=host -t ghagevaibhav/docker_compose .
- using
- Run the docker container using
docker run -e DATABASE_URL=postgresql://postgres:mysecretpassword@docker-compose:5432/postgres -p 3000:3000 --network docker-compose ghagevaibhav/docker_compose
- Install Docker Compose locally
- Clone the repository:
- using
git clone https://github.com/ghagevaibhav/week-27-docker-compose.git
- using
- Go into the directory
- using
cd week-27-docker-compose
- using
- Start the application
- using
docker-compose up
- using