Created
July 24, 2024 21:18
-
-
Save j-bullard/68cdd168a45ceaefaf00acb533efa424 to your computer and use it in GitHub Desktop.
Docker compose using vite with HMR through nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
db: | |
image: postgres:latest | |
container_name: postgres | |
restart: always | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: task_app_db | |
expose: | |
- "5432" | |
volumes: | |
- pgdata:/var/lib/postgresql/data | |
backend: | |
image: node:latest | |
container_name: backend | |
working_dir: /app | |
volumes: | |
- ./backend:/app | |
- /backend/node_modules | |
expose: | |
- "5174" | |
depends_on: | |
- db | |
command: sh -c "npm install && npm run dev" | |
frontend: | |
image: node:latest | |
container_name: frontend | |
working_dir: /app | |
volumes: | |
- ./frontend:/app | |
- /app/node_modules | |
expose: | |
- "5173" | |
depends_on: | |
- backend | |
command: sh -c "npm install && npm run dev" | |
nginx: | |
image: nginx:latest | |
container_name: nginx | |
ports: | |
- "80:80" | |
- "81:81" | |
volumes: | |
- ./nginx:/etc/nginx/conf.d | |
depends_on: | |
- frontend | |
- backend | |
volumes: | |
pgdata: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment