Used Claude to refactor pipeline code
This commit is contained in:
parent
1ded3aaba9
commit
f9799e2aa3
1 changed files with 28 additions and 28 deletions
|
|
@ -38,34 +38,34 @@ pipeline:
|
||||||
- version.txt
|
- version.txt
|
||||||
|
|
||||||
webserver-deploy:
|
webserver-deploy:
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
host:
|
host:
|
||||||
from_secret: ssh_host
|
from_secret: ssh_host
|
||||||
username:
|
username:
|
||||||
from_secret: ssh_username
|
from_secret: ssh_username
|
||||||
key:
|
key:
|
||||||
from_secret: ssh_key
|
from_secret: ssh_key
|
||||||
port: 2332
|
port: 2332
|
||||||
script:
|
script:
|
||||||
- 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 .
|
||||||
# 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
|
||||||
# Run the new container with the current version
|
# Run the new container with the current version
|
||||||
- docker run -d --name frontend -p 5173:80 frontend:$VERSION
|
- docker run -d --name frontend -p 5173:80 frontend:$VERSION
|
||||||
# Remove dangling images
|
# Remove dangling images
|
||||||
- docker image prune -f
|
- docker image prune -f
|
||||||
# Clean up unused containers, images, and volumes
|
# Clean up unused containers, images, and volumes
|
||||||
- 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;
|
||||||
done
|
done
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue