Template
01_container_build.sh: will handle Dockerfile
Repos with Dockerfile in root will be processed
This commit is contained in:
@@ -20,6 +20,12 @@ if echo "$GIT_URL" | grep -q "^git@"; then
|
|||||||
REPO=$(echo "$GIT_URL" | cut -f 2 -d '/' | xargs -- basename -s .git)
|
REPO=$(echo "$GIT_URL" | cut -f 2 -d '/' | xargs -- basename -s .git)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if true; then
|
||||||
|
echo "GIT: [$GIT]"
|
||||||
|
echo "OWNER: [$OWNER]"
|
||||||
|
echo "REPO: [$REPO]"
|
||||||
|
fi
|
||||||
|
|
||||||
# if [[ "$GIT_URL" =~ [:\/]([^\/:]+)\/([^\/\.]+)(\.git)?$ ]]; then
|
# if [[ "$GIT_URL" =~ [:\/]([^\/:]+)\/([^\/\.]+)(\.git)?$ ]]; then
|
||||||
# OWNER="${BASH_REMATCH[1]}"
|
# OWNER="${BASH_REMATCH[1]}"
|
||||||
# REPO="${BASH_REMATCH[2]}"
|
# REPO="${BASH_REMATCH[2]}"
|
||||||
@@ -45,3 +51,16 @@ done
|
|||||||
.workflow/DotDockerbuilder10.sh --solution $solution --project $project --git $GIT --gituser $OWNER --accesstoken $GITEA_API_KEY
|
.workflow/DotDockerbuilder10.sh --solution $solution --project $project --git $GIT --gituser $OWNER --accesstoken $GITEA_API_KEY
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -f ./Dockerfile ]; then
|
||||||
|
echo "Dockerfile detected at main level"
|
||||||
|
### ALL NAMES MUST BE LOWER CASE
|
||||||
|
imageName=$(echo -n "$GIT/$OWNER/$REPO:$(date +%y%m%d)" | tr '[:upper:]' '[:lower:]')
|
||||||
|
echo "DEBUG: docker build --tag=$imageName ."
|
||||||
|
sudo docker build --tag=$imageName .
|
||||||
|
echo "DEBUG: docker login $GIT --username=$OWNER --password=$GITEA_API_KEY"
|
||||||
|
sudo docker login $GIT --username=$OWNER --password=$GITEA_API_KEY
|
||||||
|
echo "DEBUG: docker push $imageName"
|
||||||
|
sudo docker push $imageName
|
||||||
|
echo "DEBUG: docker image rm $imageName"
|
||||||
|
sudo docker image rm $imageName
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user