Skip to content

Commit 128bbfd

Browse files
Update justfile
1 parent 725bc5c commit 128bbfd

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

justfile

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,48 @@ checkbash:
170170
echo "No bashisms found"
171171
fi
172172

173+
# TODO: see below @buildx
173174
# [docker] build locally
174175
build: checkbash
175176
#!/usr/bin/env bash
176177
set -euxo pipefail
178+
# https://stackoverflow.com/a/74277737
179+
BUILD_ARGS=$(for i in $(cat .env); do
180+
if [[ $i = "APP_NAME="* ]]; then
181+
continue
182+
fi
183+
out+="--build-arg $i "
184+
done
185+
echo $out; out=""
186+
)
187+
177188
if [[ {{arch}} == "arm64" ]]; then
178-
docker build -f Dockerfile -t {{APP}} --build-arg CHIPSET_ARCH=aarch64-linux-gnu .
189+
docker build -f Dockerfile -t {{APP}} --build-arg CHIPSET_ARCH=aarch64-linux-gnu ${BUILD_ARGS} .
179190
else
180-
docker build -f Dockerfile --progress=plain -t {{APP}} .
191+
docker build -f Dockerfile --progress=plain -t {{APP}} ${BUILD_ARGS} .
181192
fi
182193

183194
# [scripts] run script in working directory
184195
sh args=SCRIPT:
185196
sh {{args}}
186197

198+
# TODO: QA and possibly exclude ${TAG} in conditional
199+
# ! may have undesirable behavior for non-build env vars; possibly create new one called build.env
187200
# [docker] intel build
188201
buildx: checkbash
189-
docker buildx build -f Dockerfile --progress=plain -t ${TAG} --build-arg CHIPSET_ARCH=x86_64-linux-gnu --load .
202+
#!/usr/bin/env bash
203+
set -euxo pipefail
204+
# https://stackoverflow.com/a/74277737
205+
BUILD_ARGS=$(for i in $(cat .env); do
206+
if [[ $i = "APP_NAME="* ]]; then
207+
continue
208+
fi
209+
out+="--build-arg $i "
210+
done
211+
echo $out; out=""
212+
)
213+
214+
docker buildx build -f Dockerfile --progress=plain -t {{TAG}} --build-arg CHIPSET_ARCH=x86_64-linux-gnu ${BUILD_ARGS} --load .
190215

191216
# [docker] arm build w/docker-compose defaults
192217
build-clean: checkbash

0 commit comments

Comments
 (0)