Skip to content

Commit 4f0b0de

Browse files
authored
feat: add Docker setup for frontend and compose configuration (#89)
- Add Dockerfile for frontend containerization - Add docker-compose.yml for simplified development setup
1 parent a15eda1 commit 4f0b0de

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

docker-compose.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
services:
2+
db:
3+
image: postgres:15
4+
restart: always
5+
ports:
6+
- "5432:5432"
7+
environment:
8+
- POSTGRES_DB=flashnotes
9+
- POSTGRES_USER=flashnotes
10+
- POSTGRES_PASSWORD=flashnotes
11+
volumes:
12+
- postgres_data:/var/lib/postgresql/data
13+
14+
backend:
15+
build: ./backend
16+
ports:
17+
- "8000:8000"
18+
depends_on:
19+
- db
20+
environment:
21+
- PROJECT_NAME=FlashNotes
22+
- DOMAIN=localhost
23+
- POSTGRES_SERVER=db
24+
- POSTGRES_USER=flashnotes
25+
- POSTGRES_PASSWORD=flashnotes
26+
- POSTGRES_DB=flashnotes
27+
- FIRST_SUPERUSER=admin@example.com
28+
- FIRST_SUPERUSER_PASSWORD=admin123
29+
- USERS_OPEN_REGISTRATION=true
30+
volumes:
31+
- ./backend:/app
32+
command: sh -c "./prestart.sh && uvicorn src.main:app --reload --host 0.0.0.0 --port 8000"
33+
34+
frontend:
35+
build: ./frontend
36+
ports:
37+
- "5173:5173"
38+
depends_on:
39+
- backend
40+
volumes:
41+
- ./frontend:/app
42+
- /app/node_modules
43+
command: pnpm run dev --host 0.0.0.0
44+
45+
volumes:
46+
postgres_data:

frontend/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:18-alpine
2+
3+
WORKDIR /app
4+
5+
# Install pnpm
6+
RUN npm install -g pnpm
7+
8+
# Copy package files
9+
COPY package.json pnpm-lock.yaml ./
10+
11+
# Install dependencies
12+
RUN pnpm install
13+
14+
# Copy source code
15+
COPY . .
16+
17+
EXPOSE 5173
18+
19+
CMD ["pnpm", "run", "dev", "--host", "0.0.0.0"]

0 commit comments

Comments
 (0)