Skip to content

Commit e0d2c82

Browse files
Add docker compose file, updaet dockerfile
1 parent 2305bfc commit e0d2c82

File tree

4 files changed

+56
-10
lines changed

4 files changed

+56
-10
lines changed

.env.example

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Add your DB connection string in Database URL
22
#To use and access media files, set up cloudinary and add the details in below keys
3-
DATABASE_URL="postgresql://postgres:mypassword@localhost:5432/postgres"
4-
CLOUDINARY_CLOUD_NAME=
5-
CLOUDINARY_API_KEY=
6-
CLOUDINARY_API_SECRET=
3+
DATABASE_URL="postgresql://postgres:mypassword@db:5432/postgres"
4+
CLOUDINARY_CLOUD_NAME=your_cloud_name
5+
CLOUDINARY_API_KEY=your_api_key
6+
CLOUDINARY_API_SECRET=your_api_secret

README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h3 align="center">ByteNotes</h3>
66

77
<p align="center">
8-
The open-source Google Keep and Evernote alike software.
8+
The open-source notes making application with features like collaboration in real time and much more.
99
<br />
1010
<a href="https://akshayshinde.com"><strong>Learn more »</strong></a>
1111
<br />
@@ -62,3 +62,16 @@ We love our contributors! Here's how you can contribute:
6262
- [Open an issue](https://github.com/alphacoder-mp3/ByteNotes/issues) if you believe you've encountered a bug.
6363
- Follow the [local development guide](https://ByteNotes/docs/local-development) to get your local dev environment set up.
6464
- Make a [pull request](https://github.com/alphacoder-mp3/ByteNotes/pull) to add new features/make quality-of-life improvements/fix bugs.
65+
66+
### For Local Development (with existing PostgreSQL)
67+
68+
1. Copy `.env.example` to `.env` and update with your local PostgreSQL and Cloudinary credentials.
69+
2. Update the `DATABASE_URL` in `docker-compose.yml` to use `host.docker.internal` instead of `db`.
70+
3. Run `docker-compose -f docker/docker-compose.yml up --build`
71+
72+
### For Remote Users or Fresh Setup
73+
74+
1. Copy `.env.example` to `.env` and update with your Cloudinary credentials.
75+
2. Run `docker-compose -f docker/docker-compose.yml up --build`
76+
77+
The app will be available at http://localhost:3000

docker/Dockerfile

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM node:20.12.0-alpine3.19
22

33
WORKDIR /app
44

5-
# Copy package.json and package-lock.json
65
COPY package*.json yarn.lock tsconfig.json components.json next.config.mjs postcss.config.mjs tailwind.config.ts ./
76

87
COPY prisma ./prisma/
@@ -14,9 +13,6 @@ RUN npx prisma generate
1413

1514
COPY . .
1615

17-
RUN npm run build
18-
19-
2016
EXPOSE 3000
2117

22-
CMD ["npm", "start"]
18+
CMD ["npm", "run", "dev"]

docker/docker-compose.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build:
6+
context: ..
7+
dockerfile: docker/Dockerfile
8+
ports:
9+
- "3000:3000"
10+
environment:
11+
- DATABASE_URL=postgresql://postgres:mypassword@db:5432/postgres
12+
- CLOUDINARY_CLOUD_NAME=${CLOUDINARY_CLOUD_NAME}
13+
- CLOUDINARY_API_KEY=${CLOUDINARY_API_KEY}
14+
- CLOUDINARY_API_SECRET=${CLOUDINARY_API_SECRET}
15+
volumes:
16+
- ..:/app
17+
- /app/node_modules
18+
depends_on:
19+
- db
20+
command: sh -c "
21+
npx prisma migrate deploy &&
22+
npm run dev
23+
"
24+
25+
db:
26+
image: postgres:13
27+
environment:
28+
- POSTGRES_USER=postgres
29+
- POSTGRES_PASSWORD=mypassword
30+
- POSTGRES_DB=postgres
31+
ports:
32+
- "5433:5432"
33+
volumes:
34+
- postgres_data:/var/lib/postgresql/data
35+
36+
volumes:
37+
postgres_data:

0 commit comments

Comments
 (0)