forked from coder/deploy-code-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-images.sh
executable file
·31 lines (24 loc) · 942 Bytes
/
build-images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
# This will build and push public images in the images/ folder to
# DockerHub based on your Docker username with the
# format: $username/dev-env-$folder:latest
set -e
docker_username=$(docker-credential-$(jq -r .credsStore ~/.docker/config.json) list | jq -r '. | to_entries[] | select(.key | contains("docker.io")) | last(.value)')
build_and_push() {
folder=$1
basename=$(basename -- "$folder")
name=${basename%.*}
docker build $folder -t bencdr/dev-env-$name:latest
docker push $docker_username/dev-env-$name:latest
}
build_and_push "images/base"
# Build all other images in the images/ folder
# note: if you have multiple base images or heirchal images
# you'll want to build them in a controlled order above and
# exclude them. can be comma or space seperated :)
exclude="images/base"
for folder in images/*; do
if [[ ! "$exclude" == *"$folder"* ]]; then
build_and_push $folder
fi
done