Skip to content

Commit 3ab7328

Browse files
justfile docs + refactor
1 parent a8e7fb9 commit 3ab7328

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

justfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set dotenv-load
66
# set env var
77
export APP := "compose_image_name"
88
export CPU := "2"
9-
export IMAGE := `echo ${REGISTRY_URL}/it
9+
export IMAGE := `echo ${REGISTRY_URL}`
1010
export MEM := "2048"
1111
export NS := "default"
1212
export PROF := "minikube"
@@ -47,14 +47,13 @@ build:
4747
echo "building ${APP_NAME}:${TAG}"
4848

4949
if [[ {{arch}} == "arm64" ]]; then
50-
docker build -f Dockerfile -t it/${APP_NAME}:${TAG} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
50+
docker build -f Dockerfile -t ${APP_NAME}:${TAG} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
5151
else
52-
docker build -f Dockerfile -t it/${APP_NAME}:${TAG} --build-arg CHIPSET_ARCH=x86_64-linux-gnu .
52+
docker build -f Dockerfile -t ${APP_NAME}:${TAG} --build-arg CHIPSET_ARCH=x86_64-linux-gnu .
5353
fi
5454

55-
echo "created tag it/${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}"
55+
echo "created tag ${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}"
5656

57-
# TODO: QA
5857
# [docker] intel build
5958
buildx:
6059
docker buildx build -f Dockerfile --progress=plain -t ${TAG} --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
@@ -87,7 +86,7 @@ release:
8786
docker push {{IMAGE}}/${APP_NAME}:${TAG}
8887

8988
# [docker] start docker-compose container
90-
start:
89+
up:
9190
docker-compose up -d
9291

9392
# [docker] ssh into container
@@ -104,11 +103,10 @@ down: stop
104103

105104
# [docker] tag image as latest
106105
tag-latest:
107-
@echo "create tag it/${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}"
108-
docker tag it/${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}
106+
@echo "create tag ${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}"
107+
docker tag ${APP_NAME}:${TAG} {{IMAGE}}/${APP_NAME}:${TAG}
109108

110-
# TODO: QA
111109
# [docker] tag image from VERSION file
112110
tag-version:
113-
@echo "create tag it/${APP_NAME}:{{VERSION}} {{IMAGE}}/${APP_NAME}:${TAG}"
114-
docker tag it/${APP_NAME}:{{VERSION}} {{IMAGE}}/${APP_NAME}:${TAG}
111+
@echo "create tag ${APP_NAME}:{{VERSION}} {{IMAGE}}/${APP_NAME}:${TAG}"
112+
docker tag ${APP_NAME}:{{VERSION}} {{IMAGE}}/${APP_NAME}:${TAG}

markdown/just.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# justfile
2+
3+
> [just](https://just.systems/man/en/chapter_1.html) is a handy way to save and run project-specific commands.
4+
>
5+
> Commands, called recipes, are stored in a file called justfile with syntax inspired by make:
6+
7+
## [Install](https://just.systems/man/en/chapter_4.html)
8+
```bash
9+
# macOS
10+
brew install just
11+
12+
# Ubuntu/Debian
13+
curl -q 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null
14+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list
15+
sudo apt update
16+
sudo apt install just -y
17+
```
18+
19+
## Usage
20+
```bash
21+
# default commands
22+
just
23+
24+
# custom directives
25+
just buildx # [docker] intel build
26+
just pull # [docker] pull latest image
27+
just run # [docker] run local image
28+
just up # [docker] start docker-compose container
29+
just down # [docker] remove docker-compose container(s) and networks
30+
```

0 commit comments

Comments
 (0)