Add docker-compose production with dev command
This commit is contained in:
parent
0e377e1746
commit
2ff2329118
3 changed files with 61 additions and 4 deletions
8
dev
8
dev
|
@ -95,6 +95,14 @@ cmd_start() {
|
|||
docker-compose up
|
||||
}
|
||||
|
||||
cmd_build_production() {
|
||||
docker-compose -f docker-compose.production.yaml build
|
||||
}
|
||||
|
||||
cmd_start_production() {
|
||||
docker-compose -f docker-compose.production.yaml up --remove-orphans
|
||||
}
|
||||
|
||||
# Run the command
|
||||
cmd="$1"
|
||||
"cmd_$cmd" "$@"
|
||||
|
|
50
docker-compose.production.yaml
Normal file
50
docker-compose.production.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
local-postgres-data:
|
||||
name: local-postgres-data
|
||||
|
||||
services:
|
||||
django-backend:
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: righttree-backend
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
environment:
|
||||
- LINZ_API_KEY=${LINZ_API_KEY}
|
||||
- FRONTEND_BASE_URL=${FRONTEND_BASE_URL}
|
||||
ports:
|
||||
- "8000:8000"
|
||||
command: bash -c "./manage.py runserver 0.0.0.0:8000"
|
||||
|
||||
react-frontend:
|
||||
build:
|
||||
context: frontend
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
container_name: righttree-frontend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
working_dir: /app
|
||||
command: sh -c "serve -s build"
|
||||
|
||||
|
||||
postgres:
|
||||
image: postgis/postgis:13-3.0
|
||||
restart: unless-stopped
|
||||
container_name: postgres
|
||||
volumes:
|
||||
- local-postgres-data:/var/lib/postgresql/data
|
||||
- ./create_database.sql:/docker-entrypoint-initdb.d/create_database.sql
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
|
|
@ -42,7 +42,6 @@ services:
|
|||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=postgres
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
Loading…
Reference in a new issue