From 06f291ca7842ea8bb69b36076d58805bf3363be6 Mon Sep 17 00:00:00 2001 From: Murtadha Date: Sun, 14 Jul 2024 02:11:30 -0400 Subject: [PATCH] Refactor steps with pipeline --- .woodpecker.yml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4e1e958..d64db50 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,7 +2,7 @@ # type: docker # name: frontend-deployment -pipeline: +steps: build: image: node:22 commands: @@ -36,25 +36,25 @@ pipeline: key: from_secret: ssh_key port: 2332 - commands: - - 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 . - # Stop and remove the existing container if it exists - - docker stop frontend || true - - docker rm frontend || true - # Run the new container with the current version - - docker run -d --name frontend -p 5173:80 frontend:$VERSION - # Remove dangling images - - docker image prune -f - # Clean up unused containers, images, and volumes - - 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 + script: + - 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 . + # Stop and remove the existing container if it exists + - docker stop frontend || true + - docker rm frontend || true + # Run the new container with the current version + - docker run -d --name frontend -p 5173:80 frontend:$VERSION + # Remove dangling images + - docker image prune -f + # Clean up unused containers, images, and volumes + - 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 trigger: event: