Skip to content

Commit 20c6725

Browse files
pos args, env vars, add devspace, context within comments
1 parent cfc05dd commit 20c6725

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

justfile

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
# See https://just.systems/man/en
22

3+
# positional args
4+
# * NOTE: unable to reuse recipe name (e.g., start/stop); prefix recipes with `@`
5+
# set positional-arguments := true
6+
37
# load .env
48
set dotenv-load := true
59

610
# set env var
711
export APP := "compose_image_name"
8-
export SHELL := "/bin/sh"
12+
export CPU := "2"
13+
export MEM := "2048"
14+
export NS := "default"
15+
export PROF := "minikube"
16+
export SHELL := "/bin/bash"
917
export TAG := "latest"
1018

1119
# x86_64/arm64
@@ -14,45 +22,61 @@ arch := `uname -m`
1422
# hostname
1523
host := `uname -n`
1624

17-
# halp
25+
# [halp] list available commands
1826
default:
1927
just --list
2028

21-
# build locally or on intel box
29+
# [devspace] start minikube + devspace
30+
start-devspace:
31+
#!/usr/bin/env bash
32+
set -euxo pipefail
33+
34+
if [[ $(minikube status -f \{\{\.Host\}\}) = 'Stopped' ]]; then
35+
minikube start --memory={{MEM}} --cpus={{CPU}} -p {{PROF}}
36+
fi
37+
38+
devspace use namespace {{NS}}
39+
devspace dev
40+
41+
# [devspace] stop minikube
42+
stop-devspace:
43+
minikube stop -p {{PROF}}
44+
45+
# [docker] build locally or on intel box
2246
build:
2347
#!/usr/bin/env bash
2448
set -euxo pipefail
25-
# accepts justfile env/vars
49+
2650
if [[ {{arch}} == "arm64" ]]; then
27-
docker build -f Dockerfile.web -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
51+
docker build -f Dockerfile -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
2852
else
29-
docker buildx build -f Dockerfile.web --progress=plain -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
53+
docker buildx build -f Dockerfile --progress=plain -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
3054
fi
3155

32-
# intel build
56+
# [docker] intel build
3357
buildx:
34-
docker buildx build -f Dockerfile.web --progress=plain -t $TAG --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
58+
docker buildx build -f Dockerfile --progress=plain -t $TAG --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
3559

36-
# arm build w/docker-compose defaults
60+
# [docker] arm build w/docker-compose defaults
3761
build-clean:
3862
docker-compose build --pull --no-cache --build-arg CHIPSET_ARCH=aarch64-linux-gnu
3963

40-
# pull latest image
64+
# [docker] pull latest heroku image
4165
pull:
42-
docker pull "{{APP}}:{{TAG}}"
66+
docker pull python:3.10-slim-buster
4367

44-
# start docker-compose container
45-
start:
68+
# [docker] start docker-compose container
69+
up:
4670
docker-compose up -d
4771

48-
# ssh into container
72+
# [docker] ssh into container
4973
exec:
5074
docker-compose exec {{APP}} {{SHELL}}
5175

52-
# stop docker-compose container
76+
# [docker] stop docker-compose container
5377
stop:
5478
docker-compose stop
5579

56-
# remove docker-compose container(s) and networks
80+
# [docker] remove docker-compose container(s) and networks
5781
down:
5882
docker-compose stop && docker-compose down --remove-orphans

0 commit comments

Comments
 (0)