Skip to content

Commit

Permalink
fix: enhance docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
geekyharsh05 committed Oct 6, 2024
1 parent f5055a9 commit 1cc8c38
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 32 deletions.
45 changes: 22 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ services:
app:
container_name: muzer-docker
build:
context: ./next-app/
context: ./next-app
dockerfile: Dockerfile.dev
env_file:
- path: ./next-app/.env
- ./next-app/.env
ports:
- ${APP_PORT}:3000
- "3000:3000"
- "5555:5555"
depends_on:
postgres:
condition: service_healthy
Expand All @@ -22,9 +23,9 @@ services:
image: postgres:alpine
restart: always
env_file:
- path: ./next-app/.env
- ./next-app/.env
ports:
- ${POSTGRES_PORT}:5432
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
Expand All @@ -33,29 +34,27 @@ services:
timeout: 5s
retries: 5

prisma-studio:
container_name: prisma-studio
image: timothyjmiller/prisma-studio:latest
restart: unless-stopped
env_file:
- path: ./next-app/.env
depends_on:
- postgres:
condition: service_healthy
ports:
- ${PRISMA_STUDIO_PORT}:5555
# prisma-studio:
# container_name: prisma-studio
# image: timothyjmiller/prisma-studio:latest
# restart: unless-stopped
# depends_on:
# postgres:
# condition: service_healthy
# ports:
# - "5555:5555"

redis:
container_name: redis-server
image: redis/redis-stack:latest
restart: always
env_file:
- path: ./ws/.env
- ./ws/.env
ports:
- ${REDIS_PORT}:6379
- ${REDIS_BROWSER_STACK_PORT}:8001
- "6379:6379"
- "8001:8001"
environment:
REDIS_ARGS: "--requirepass ${REDIS_PASSWORD} --user ${REDIS_USERNAME} on >${REDIS_PASSWORD} ~* allcommands --user default off nopass nocommands"
REDIS_ARGS: "--requirepass root --user admin on >root ~* allcommands --user default off nopass nocommands"
volumes:
- redis-data:/data
healthcheck:
Expand All @@ -68,12 +67,12 @@ services:
container_name: websockets
restart: always
build:
context: ./ws/
context: ./ws
dockerfile: Dockerfile.dev
env_file:
- path: ./ws/.env
- ./ws/.env
ports:
- ${PORT}:8080
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
Expand Down
5 changes: 1 addition & 4 deletions next-app/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ POSTGRES_PORT=5432
POSTGRES_URL=postgresql://postgres:postgres@postgres:5432/postgres
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
PRISMA_STUDIO_PORT=5555
POSTGRES_PATH=postgres-data

POSTGRES_PASSWORD=postgres
5 changes: 3 additions & 2 deletions next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"prisma:studio": "npx prisma studio",
"studio": "npx prisma studio",
"postinstall": "prisma generate",
"prisma:migrate": "prisma migrate dev",
"dev:docker": "pnpm prisma:migrate && pnpm dev",
"prisma:docker": "pnpm postinstall && pnpm prisma:migrate && pnpm studio",
"dev:docker": "pnpm prisma:docker & pnpm dev",
"format:fix": "prettier --write \"**/*.{ts,tsx,json}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,json}\""
},
Expand Down
5 changes: 2 additions & 3 deletions ws/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ PORT=8080
NEXTAUTH_SECRET="secret"
DATABASE_URL=""

REDIS_USERNAME=""
REDIS_USERNAME="admin"
REDIS_PORT=6379
REDIS_HOST="127.0.0.1" # for docker change it to "redis"
REDIS_PASSWORD=""
REDIS_BROWSER_STACK_PORT=8001
REDIS_PASSWORD="root"

0 comments on commit 1cc8c38

Please sign in to comment.