@@ -21,9 +21,17 @@ install: ## Install Python package dependencies.
2121test : # # Run automated tests.
2222 ENVIRONMENT=test poetry run pytest --cov
2323
24+ .PHONY : up
25+ up : # # Start all containers.
26+ $(COMPOSE ) -f ./docker-compose.yml up -d --force-recreate
27+
28+ .PHONY : recreate
29+ recreate : # # Recreate all containers.
30+ $(COMPOSE ) -f ./docker-compose.yml up -d --force-recreate --build
31+
2432.PHONY : up-database
2533up-database : # # Start database container.
26- $(COMPOSE ) up -d postgres --force-recreate
34+ $(COMPOSE ) -f ./docker-compose.yml up -d database --force-recreate
2735
2836.PHONY : down
2937down : # # Stop all containers.
@@ -80,8 +88,15 @@ init-env: ## Copy .env.example to .env and populate SECRET_KEY, ALGORITHM, ACCES
8088 exit 1; \
8189 fi ;
8290
91+ @if [ -f .env.docker ]; then \
92+ echo "Error: .env.docker already exists. Aborting."; \
93+ exit 1; \
94+ fi;
95+
8396 @cp .env.example .env
97+ @cp .env.docker.example .env.docker
8498 @sed -i '' -e '/^SECRET_KEY=/d' -e '/^ALGORITHM=/d' -e '/^ACCESS_TOKEN_EXPIRE_MINUTES=/d' .env
99+ @sed -i '' -e '/^SECRET_KEY=/d' -e '/^ALGORITHM=/d' -e '/^ACCESS_TOKEN_EXPIRE_MINUTES=/d' .env.docker
85100
86101 @SECRET_KEY=$$( \
87102 if command -v python >/dev/null 2>&1; then \
@@ -96,10 +111,12 @@ init-env: ## Copy .env.example to .env and populate SECRET_KEY, ALGORITHM, ACCES
96111 echo "Error: Failed to generate SECRET_KEY. Aborting."; \
97112 exit 1; \
98113 fi; \
99- echo "SECRET_KEY=$$SECRET_KEY" >> .env
114+ echo "SECRET_KEY=$$SECRET_KEY" | tee -a .env .env.docker > /dev/null
100115
101116 @echo "ALGORITHM=HS256" >> .env
102117 @echo "ACCESS_TOKEN_EXPIRE_MINUTES=30" >> .env
118+ @echo "ALGORITHM=HS256" >> .env.docker
119+ @echo "ACCESS_TOKEN_EXPIRE_MINUTES=30" >> .env.docker
103120
104121.PHONY : clean
105122clean : # # Clean project's temporary files.
0 commit comments