-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·59 lines (46 loc) · 1.72 KB
/
Makefile
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
# https://docs.docker.com/develop/develop-images/build_enhancements/
# https://www.docker.com/blog/faster-builds-in-compose-thanks-to-buildkit-support/
export DOCKER_BUILDKIT := 1
export DOCKER_SCAN_SUGGEST := false
export COMPOSE_DOCKER_CLI_BUILD := 1
ifndef HOSTIP
ifeq ($(OS),Windows_NT)
HOSTIP := $(shell powershell -command '(Get-NetIPConfiguration | Where-Object {$$_.IPv4DefaultGateway -ne $$null -and $$_.NetAdapter.Status -ne "Disconnected"}).IPv4Address.IPAddress' )
# UPSTREAM_DNS := $(shell powershell -command '(Get-NetRoute | where {$$_.DestinationPrefix -eq '0.0.0.0/0'} | select { $$_.NextHop }' )
else
# UPSTREAM_DNS = $(shell /sbin/ip route | awk '/default/ { print $$3 }')
ifeq ($(UNAME_S),Linux)
HOSTIP := $(shell ip route get 1 | head -1 | awk '{print $$7}' )
endif
ifeq ($(UNAME_S),Darwin)
HOSTIP := $(shell ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $$2}' )
endif
endif
endif
export HOSTIP
export UPSTREAM_DNS
start: build
docker compose up --force-recreate --remove-orphans -d
up: build
docker compose up --force-recreate --abort-on-container-exit --remove-orphans
restart: build down start
down:
docker compose down
echo:
@echo "HOSTIP: $(HOSTIP)"
@echo "UPSTREAM_DNS: $(UPSTREAM_DNS)"
logs:
docker compose logs -f
bash: build
docker compose run --rm joyride bash
attach:
docker compose exec joyride bash
build:
docker compose build
clean:
docker compose down --volumes --remove-orphans --rmi local
docker compose rm -f
-docker image rm -f $(shell docker image ls -q --filter label=ilude-project=joyride)
-rm Dockerfile
test: build
docker compose -f docker compose.yml -f docker compose.whoami.yml up --force-recreate --abort-on-container-exit --remove-orphans