-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
76 lines (56 loc) · 1.93 KB
/
makefile
File metadata and controls
76 lines (56 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Initial variables
os ?= $(shell uname -s)
ifeq ($(os), Darwin)
open = open
else ifeq ($(shell uname), Linux)
open = xdg-open
else ifeq ($(shell uname), Windows_NT)
open = explorer
endif
build: recreate ?=
build:
docker compose up -d --build --remove-orphans $(recreate) $(container)
remove: ## Remove containers
docker compose rm --force --stop $(container)
reload up: ## Reload one or all containers
docker compose up -d $(container)
down:
docker compose down $(container)
stop:
docker compose stop $(container)
start:
docker compose start $(container)
restart:
docker compose restart $(container)
rebuild: | down build ## Rebuild containers
reboot: | remove up ## Recreate containers
status ps:
docker compose ps $(container)
cli exec: container ?= app
cli exec: bash ?= ash
cli exec: ## Execute commands in containers, use "command" argument to send the command. By Default enter the shell.
docker compose exec $(container) $(bash) $(command)
run: container ?= app
run: bash ?= ash
run: ## Run commands in a new container
docker compose run --rm $(container) $(bash) $(command)
config:
docker compose config
logs: container ?= app
logs: ## Show logs. Usage: make logs [container=app]
docker compose logs -f $(container)
copy: container ?= app
copy: ## Copy app files/directories from container to host
docker cp $(shell docker compose ps -q $(container)):$(path) .
open: ## Open app in the browser
$(open) $(subst 0.0.0.0,localhost,http://$(shell docker compose port app 8080))/greeting
expose: ## Expose your local environment to the internet, thanks to Serveo (https://serveo.net)
ssh -R 80:localhost:$(subst 0.0.0.0:,,$(shell docker compose port app 8080)) serveo.net
h help: ## This help.
@echo 'Usage: make <task>'
@echo 'Default task: build'
@echo
@echo 'Tasks:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9., _-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := build
.PHONY: all