Skip to content

Commit

Permalink
ci(scripts): add docker registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeptossss committed Nov 29, 2023
1 parent 8afa6fb commit 6ff90bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
3 changes: 3 additions & 0 deletions helm/whanos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ jenkins:
- type: HostPath
hostPath: /whanos
mountPath: /whanos
envVars:
- name: DOCKER_REGISTRY
value: "whanos-docker-registry:5000"
14 changes: 7 additions & 7 deletions jenkins/job_dsl.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ languages.each { language ->

freeStyleJob("Whanos base images/Build all base images") {
steps {
shell('''
cp -r /whanos/scripts/install_dockercli.sh .
chmod -R 777 install_dockercli.sh
ls -la
sh -c "./install_dockercli.sh"
''')
languages.each { language ->
shell('''
cp -r /whanos/scripts/install_dockercli.sh .
chmod -R 777 install_dockercli.sh
ls -la
sh -c "./install_dockercli.sh"
''')
shell("docker build /whanos/images/$language -t whanos-$language -f /whanos/images/$language/Dockerfile.base")
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@ freeStyleJob("link-project") {
cp -r /whanos/scripts/* .
chmod -R 777 .
ls -la
sh -c "./whanos.sh"
sh -c "./whanos.sh \\\"DISPLAY_NAME\\\""
\'\'\')
}
}
Expand Down
11 changes: 7 additions & 4 deletions scripts/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash
LANGUAGE=$1
NAME=$2

image_name=$DOCKER_REGISTRY/whanos/whanos-$NAME-$LANGUAGE

if [[ -f Dockerfile ]]; then
docker build . -t $image_name
docker build . -t "$image_name"
else
docker build . \
-f /images/${LANGUAGE}/Dockerfile.standalone \
-t $image_name
-f /images/"${LANGUAGE}"/Dockerfile.standalone \
-t "$image_name"
fi

if ! docker push $image_name; then
if ! docker push "$image_name"; then
exit 1
fi
4 changes: 3 additions & 1 deletion scripts/whanos.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DISPLAY_NAME=$1

# Install docker-cli
./install_dockercli.sh
if [ $? -ne 0 ]; then
Expand All @@ -16,7 +18,7 @@ fi
language=$(./detect_language.sh)

# Execute build_image.sh script with the output of detect_language.sh as argument
./build_image.sh "$language"
./build_image.sh "$language" "$DISPLAY_NAME"
if [ $? -ne 0 ]; then
echo "build_image.sh failed"
exit 1
Expand Down

0 comments on commit 6ff90bb

Please sign in to comment.