Skip to content

Commit

Permalink
fix: docker build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Dec 30, 2023
1 parent 4d853fd commit 55413b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/devops/docker-build-and-push-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ password=""
push=false

# Process command-line arguments
while [[ $# -gt 0 ]]; do
while [ $# -gt 0 ]; do
case $1 in
-u)
shift
Expand Down Expand Up @@ -63,6 +63,7 @@ echo "push: $push"
# 构建镜像
echo "Building image: "${IMAGE}:${IMAGE_TAG}
docker build ${BUILD_CONTEXT} -t ${IMAGE}:${IMAGE_TAG} -f $DOCKERFILE_PATH .
docker tag ${IMAGE}:${IMAGE_TAG} ${IMAGE}:latest

if [ "$push" = true ]; then
echo "push is true. Performing push operation..."
Expand All @@ -73,7 +74,7 @@ if [ "$push" = true ]; then

# 推送
echo "Pushing to registry..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${IMAGE_TAG} -a

echo "Build and push complete!"
else
Expand Down

0 comments on commit 55413b5

Please sign in to comment.