Skip to content

Commit 2144ce5

Browse files
committed
feat: updating
Makefile updates refactor: move to docker native variable for project names feat: fail-proof execution of project, if .env was not configured
1 parent 7f78d9e commit 2144ce5

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
-include .env
2+
3+
ifeq ($(COMPOSE_PROJECT_NAME),)
4+
COMPOSE_PROJECT_NAME = "ss"
5+
endif
6+
17
export DOCKER_BUILDKIT ?= 1
2-
DOCKER_COMPOSE ?= docker-compose
8+
export COMPOSE_PROJECT_NAME_SLUG = $(subst $e.,-,$(COMPOSE_PROJECT_NAME))
9+
export COMPOSE_PROJECT_NAME_SAFE = $(subst $e.,_,$(COMPOSE_PROJECT_NAME))
10+
11+
DOCKER ?= docker
12+
DOCKER_COMPOSE ?= docker compose -p $(COMPOSE_PROJECT_NAME_SAFE)
313
BUILDER_IMAGE ?= wayofdev/build-deps:alpine-latest
414

515
ifneq ($(TERM),)
@@ -32,7 +42,7 @@ help:
3242
@echo 'Management commands for package:'
3343
@echo 'Usage:'
3444
@echo ' ${MAKE_CMD_COLOR}make${RST} Builds default image and then runs dgoss tests'
35-
@grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " ${MAKE_CMD_COLOR}make %-21s${RST} %s\n", $$1, $$2}'
45+
@grep -E '^[a-zA-Z_0-9%-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf " ${MAKE_CMD_COLOR}make %-21s${RST} %s\n", $$1, $$2}'
3646
@echo
3747
@echo ' 📑 Logs are stored in $(MAKE_LOGFILE)'
3848
@echo
@@ -76,7 +86,9 @@ stop: ## Stops all containers, without removing them
7686
.PHONY: stop
7787

7888
restart: ## Restart all containers, running in this project
79-
$(DOCKER_COMPOSE) restart
89+
# $(DOCKER_COMPOSE) restart
90+
$(DOCKER_COMPOSE) down
91+
$(DOCKER_COMPOSE) up
8092
.PHONY: restart
8193

8294
logs: ## Show logs for running containers in this project
@@ -92,6 +104,7 @@ pull: ## Pull upstream images, specified in docker-compose.yml file
92104
.PHONY: pull
93105

94106
clean:
107+
# $(DOCKER_COMPOSE) down -v
95108
$(DOCKER_COMPOSE) rm --force --stop
96109
.PHONY: clean
97110

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ This repository configures Traefik to run together with, installed in system, dn
7373

7474
Leave blank `SHARED_DOMAIN_SEGMENT`, to run shared services under first level domain, example:
7575

76-
* router.docker,
77-
* pg-admin.docker,
76+
* router.docker,
77+
* pg-admin.docker,
7878
* ui.docker
7979
* etc.
8080

@@ -158,10 +158,10 @@ This repository was created in **2022** by [lotyp / wayofdev](https://github.com
158158

159159
## 🫡 Contributors
160160

161-
<img align="left" src="https://img.shields.io/github/contributors-anon/wayofdev/docker-shared-services?style=for-the-badge"/>
161+
<img align="left" src="https://img.shields.io/github/contributors-anon/wayofdev/docker-shared-services?style=for-the-badge" alt="Contributors"/>
162162

163163
<a href="https://github.com/wayofdev/docker-nginx/graphs/contributors">
164-
<img src="https://opencollective.com/wod/contributors.svg?width=890&button=false">
164+
<img src="https://opencollective.com/wod/contributors.svg?width=890&button=false" alt="Contributors">
165165
</a>
166166

167167
<br>

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242

4343
networks:
4444
default:
45-
name: ss_shared_network
45+
name: ${COMPOSE_PROJECT_NAME}_network
4646
ipam:
4747
config:
4848
- subnet: 172.100.61.1/24

0 commit comments

Comments
 (0)