Fixed docker make targets.

This commit is contained in:
mikestefanello 2022-11-04 18:49:25 -04:00
parent bf8df2624b
commit 76ccf3b8db
2 changed files with 13 additions and 7 deletions

View file

@ -1,22 +1,26 @@
# Determine if you have docker-compose or docker compose installed locally
# If this does not work on your system, just set the name of the executable you have installed
DCO_BIN := $(shell { command -v docker-compose || command -v docker compose; } 2>/dev/null)
# Connect to the primary database # Connect to the primary database
.PHONY: db .PHONY: db
db: db:
docker compose exec -it db psql postgresql://admin:admin@localhost:5432/app docker exec -it pagoda_db psql postgresql://admin:admin@localhost:5432/app
# Connect to the test database # Connect to the test database (you must run tests first before running this)
.PHONY: db-test .PHONY: db-test
db-test: db-test:
docker compose exec -it db psql postgresql://admin:admin@localhost:5432/app_test docker exec -it pagoda_db psql postgresql://admin:admin@localhost:5432/app_test
# Connect to the primary cache # Connect to the primary cache
.PHONY: cache .PHONY: cache
cache: cache:
docker compose exec -it cache redis-cli docker exec -it pagoda_cache redis-cli
# Connect to the test cache # Connect to the test cache
.PHONY: cache-test .PHONY: cache-test
cache-test: cache-test:
docker compose exec -it cache redis-cli -n 1 docker exec -it pagoda_cache redis-cli -n 1
# Install Ent code-generation module # Install Ent code-generation module
.PHONY: ent-install .PHONY: ent-install
@ -36,13 +40,13 @@ ent-new:
# Start the Docker containers # Start the Docker containers
.PHONY: up .PHONY: up
up: up:
docker compose up -d $(DCO_BIN) up -d
sleep 3 sleep 3
# Rebuild Docker containers to wipe all data # Rebuild Docker containers to wipe all data
.PHONY: reset .PHONY: reset
reset: reset:
docker compose down $(DCO_BIN) down
make up make up
# Run the application # Run the application

View file

@ -3,10 +3,12 @@ version: "3"
services: services:
cache: cache:
image: "redis:alpine" image: "redis:alpine"
container_name: pagoda_cache
ports: ports:
- "6379:6379" - "6379:6379"
db: db:
image: postgres:alpine image: postgres:alpine
container_name: pagoda_db
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment: