Skip to content

Commit a864b99

Browse files
Adapt justfiles for Docker Compose command (#1153)
This should solve #1149. See also [my comment there for the approach](#11). In short through a variable that is substituted. Note that this may not work if an older Docker version is installed without the Python `docker-compose` script...As both variants will not be present. Maybe add an extra test+warning msg for that case. ``` dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi` . . up: {{ dockercompose }} up up-build: {{ dockercompose }} up --build . . ``` --------- Co-authored-by: Lucas <[email protected]>
1 parent e540d46 commit a864b99

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

demo/justfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22

33
set shell := ["bash", "-c"]
44

5+
dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi`
6+
57
@_default:
68
just --list --unsorted
79

810
clean:
911
rm -rf frontend/node_modules
1012

1113
up:
12-
docker-compose up
14+
{{ dockercompose }} up
1315

1416
up-build:
15-
docker-compose up --build
17+
{{ dockercompose }} up --build
1618

1719
build:
18-
docker-compose build
20+
{{ dockercompose }} build
1921

2022
up-backend:
21-
docker-compose up db tiles --detach
23+
{{ dockercompose }} up db tiles --detach
2224

2325
frontend *ARGS:
24-
docker-compose up frontend {{ ARGS }}
26+
{{ dockercompose }} up frontend {{ ARGS }}
2527

2628
[no-exit-message]
2729
frontend-sh:
28-
docker-compose run --interactive --entrypoint sh frontend
30+
{{ dockercompose }} run --interactive --entrypoint sh frontend

justfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export CARGO_TERM_COLOR := "always"
1515
#export RUST_LOG := "sqlx::query=info,trace"
1616
#export RUST_BACKTRACE := "1"
1717

18+
dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi`
19+
1820
@_default:
1921
{{ just_executable() }} --list --unsorted
2022

@@ -71,12 +73,12 @@ start-legacy: (docker-up "db-legacy") docker-is-ready
7173
# Start a specific test database, e.g. db or db-legacy
7274
[private]
7375
docker-up name: start-pmtiles-server
74-
docker-compose up -d {{ name }}
76+
{{ dockercompose }} up -d {{ name }}
7577

7678
# Wait for the test database to be ready
7779
[private]
7880
docker-is-ready:
79-
docker-compose run -T --rm db-is-ready
81+
{{ dockercompose }} run -T --rm db-is-ready
8082

8183
alias _down := stop
8284
alias _stop-db := stop
@@ -89,11 +91,11 @@ restart:
8991

9092
# Stop the test database
9193
stop:
92-
docker-compose down --remove-orphans
94+
{{ dockercompose }} down --remove-orphans
9395

9496
# Start test server for testing HTTP pmtiles
9597
start-pmtiles-server:
96-
docker-compose up -d fileserver
98+
{{ dockercompose }} up -d fileserver
9799

98100
# Run benchmark tests
99101
bench:

0 commit comments

Comments
 (0)