Used Claude to refactor pipeline code

This commit is contained in:
Murtadha 2024-07-19 18:06:43 -04:00
parent f9799e2aa3
commit 04d5d286a1

View file

@ -37,7 +37,7 @@ pipeline:
- nginx.conf - nginx.conf
- version.txt - version.txt
webserver-deploy: webserver-deploy:
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host:
@ -51,7 +51,7 @@ pipeline:
- cd /home/mnisyif/docker-containers/mnisyif/frontend - cd /home/mnisyif/docker-containers/mnisyif/frontend
- VERSION=$(cat version.txt) - VERSION=$(cat version.txt)
# Build the new Docker image with the current version tag # Build the new Docker image with the current version tag
- docker build -t frontend:$VERSION . - docker build -t frontend:$VERSION . || { echo "Docker build failed"; exit 1; }
# Stop and remove the existing container if it exists # Stop and remove the existing container if it exists
- docker stop frontend || true - docker stop frontend || true
- docker rm frontend || true - docker rm frontend || true
@ -63,9 +63,9 @@ pipeline:
- docker system prune -f --volumes - docker system prune -f --volumes
# Remove older versions of the Docker image # Remove older versions of the Docker image
- > - >
for img in $(docker images frontend --format "{{.Tag}}" | grep -v $VERSION); do for img in $(docker images frontend --format "{{.Tag}}" | grep -v $VERSION); do
docker rmi frontend:$img; docker rmi frontend:$img || true;
done done
trigger: trigger:
event: event: