Skip to content

Commit

Permalink
feat-krishnaacharyaa#131:dockerized the app
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 6, 2024
1 parent 0dae320 commit a73e93a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
5 changes: 3 additions & 2 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
MONGODB_URI="mongodb://127.0.0.1/wanderlust"
MONGODB_URI="mongodb://mongo/wanderlust"
REDIS_URL="redis://127.0.0.1:6379"
CORS_ORIGIN="http://3.111.34.38:5173"
ACCESS_COOKIE_MAXAGE=120000
ACCESS_TOKEN_EXPIRES_IN='120s'
REFRESH_COOKIE_MAXAGE=120000
REFRESH_TOKEN_EXPIRES_IN='120s'
JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df
JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df
7 changes: 7 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:21
WORKDIR /app
COPY . .
RUN npm i
COPY .env.sample .env
CMD ["npm","start"]
EXPOSE 5000
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.8"
services:
mongodb:
container_name: mongo
image: mongo:latest
volumes:
- ./backend/data:/data
ports:
- "27017:27017"

backend:
container_name: backend
build: ./backend
env_file: ./backend/.env.sample
depends_on:
- mongodb
ports:
- "5000:5000"

frontend:
container_name: frontend
build: ./frontend
env_file: ./frontend/.env.sample
ports:
- "5173:5173"

volumes:
data:
2 changes: 1 addition & 1 deletion frontend/.env.sample
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_PATH="http://localhost:5000"
VITE_API_PATH="http://3.111.34.38:5000"
7 changes: 7 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:21
WORKDIR /app
COPY . .
RUN npm i
COPY .env.sample .env.local
CMD ["npm","run","dev","--","--host"]
EXPOSE 5173

0 comments on commit a73e93a

Please sign in to comment.