Update .gitlab-ci.yml file

This commit is contained in:
Silver Labs 2025-09-29 17:58:58 +02:00
parent 84b0a880f6
commit fb3269e680

View File

@ -10,11 +10,11 @@ build:
image: docker:24 image: docker:24
script: script:
- echo "Building LittleShop Docker image" - echo "Building LittleShop Docker image"
- docker build -t localhost:5000/littleshop:latest . - docker build -t gitlabs.silverlabs.uk:443/littleshop:latest .
- | - |
if [ -n "$CI_COMMIT_TAG" ]; then if [ -n "$CI_COMMIT_TAG" ]; then
echo "Tagging as version $CI_COMMIT_TAG" echo "Tagging as version $CI_COMMIT_TAG"
docker tag localhost:5000/littleshop:latest localhost:5000/littleshop:$CI_COMMIT_TAG docker tag gitlabs.silverlabs.uk:443/littleshop:latest gitlabs.silverlabs.uk:443/littleshop:$CI_COMMIT_TAG
fi fi
- echo "Build complete" - echo "Build complete"
rules: rules:
@ -49,13 +49,13 @@ deploy:vps:
export VERSION="$VERSION" export VERSION="$VERSION"
# Tag the image # Tag the image
docker tag littleshop:\$VERSION localhost:5000/littleshop:\$VERSION docker tag littleshop:\$VERSION gitlabs.silverlabs.uk:443/littleshop:\$VERSION
docker tag littleshop:\$VERSION localhost:5000/littleshop:latest docker tag littleshop:\$VERSION gitlabs.silverlabs.uk:443/littleshop:latest
# Push to local registry # Push to local registry
echo "Pushing to local Docker registry..." echo "Pushing to local Docker registry..."
docker push localhost:5000/littleshop:\$VERSION docker push gitlabs.silverlabs.uk:443/littleshop:\$VERSION
docker push localhost:5000/littleshop:latest docker push gitlabs.silverlabs.uk:443/littleshop:latest
# Navigate to deployment directory # Navigate to deployment directory
cd /opt/littleshop cd /opt/littleshop
@ -125,7 +125,7 @@ rollback:vps:
cd /opt/littleshop cd /opt/littleshop
# Pull previous image # Pull previous image
docker tag localhost:5000/littleshop:previous localhost:5000/littleshop:latest docker tag gitlabs.silverlabs.uk:443/littleshop:previous gitlabs.silverlabs.uk:443/littleshop:latest
# Restart services # Restart services
echo "Restarting with previous version..." echo "Restarting with previous version..."