Skip to content

Commit 4468b0d

Browse files
Merge pull request #24 from pythoninthegrass/justfile
Add justfile
2 parents 08fcd99 + 98ada9b commit 4468b0d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

justfile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# See https://just.systems/man/en
2+
3+
# load .env
4+
set dotenv-load := true
5+
6+
# set env var
7+
export APP := "compose_image_name"
8+
export SHELL := "/bin/sh"
9+
export TAG := "latest"
10+
11+
# x86_64/arm64
12+
arch := `uname -m`
13+
14+
# hostname
15+
host := `uname -n`
16+
17+
# halp
18+
default:
19+
just --list
20+
21+
# build locally or on intel box
22+
build:
23+
#!/usr/bin/env bash
24+
set -euxo pipefail
25+
# accepts justfile env/vars
26+
if [[ {{arch}} == "arm64" ]]; then
27+
docker build -f Dockerfile.web -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
28+
else
29+
docker buildx build -f Dockerfile.web --progress=plain -t {{APP}}:{{TAG}} --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
30+
fi
31+
32+
# intel build
33+
buildx:
34+
docker buildx build -f Dockerfile.web --progress=plain -t $TAG --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
35+
36+
# arm build w/docker-compose defaults
37+
build-clean:
38+
docker-compose build --pull --no-cache --build-arg CHIPSET_ARCH=aarch64-linux-gnu
39+
40+
# pull latest image
41+
pull:
42+
docker pull "{{APP}}:{{TAG}}"
43+
44+
# start docker-compose container
45+
start:
46+
docker-compose up -d
47+
48+
# ssh into container
49+
exec:
50+
docker-compose exec {{APP}} {{SHELL}}
51+
52+
# stop docker-compose container
53+
stop:
54+
docker-compose stop
55+
56+
# remove docker-compose container(s) and networks
57+
down:
58+
docker-compose stop && docker-compose down --remove-orphans

0 commit comments

Comments
 (0)