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
- version.txt
webserver-deploy:
webserver-deploy:
image: appleboy/drone-ssh
settings:
host:
@ -51,7 +51,7 @@ pipeline:
- cd /home/mnisyif/docker-containers/mnisyif/frontend
- VERSION=$(cat version.txt)
# 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
- docker stop frontend || true
- docker rm frontend || true
@ -63,9 +63,9 @@ pipeline:
- docker system prune -f --volumes
# Remove older versions of the Docker image
- >
for img in $(docker images frontend --format "{{.Tag}}" | grep -v $VERSION); do
docker rmi frontend:$img;
done
for img in $(docker images frontend --format "{{.Tag}}" | grep -v $VERSION); do
docker rmi frontend:$img || true;
done
trigger:
event: