diff --git a/.woodpecker.yml b/.woodpecker.yml index 380a8cd..da62fde 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -43,7 +43,7 @@ steps: - nginx.conf - version.txt - - name: build-and-deploy + - name: deploy image: appleboy/drone-ssh settings: host: @@ -55,20 +55,23 @@ steps: port: 2332 script: - cd /home/mnisyif/docker-containers/mnisyif/frontend - - VERSION=$(cat version.txt) - - echo "Building and deploying version: $VERSION" - - | - cat << EOF > Dockerfile - FROM nginx:alpine - COPY nginx.conf /etc/nginx/nginx.conf - COPY dist /usr/share/nginx/html - COPY resumes /usr/share/nginx/html/resumes - EOF - - docker build -t frontend:$VERSION . - - docker stop frontend-$VERSION || true - - docker rm frontend-$VERSION || true - - docker run -d --name frontend-$VERSION -p 5173:80 frontend:$VERSION - - echo "Deployment attempt completed" + - VERSION=$(cat version.txt) + - echo "Nginx configuration:" + - cat nginx.conf + - echo "Contents of dist directory:" + - ls -la dist + # 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, mounting the files + - > + docker run -d --name frontend -p 5173:80 + -v /home/mnisyif/docker-containers/mnisyif/frontend/dist:/usr/share/nginx/html:ro + -v /home/mnisyif/docker-containers/mnisyif/frontend/nginx.conf:/etc/nginx/nginx.conf:ro + nginx:alpine + # Tag the running container with the version + - docker tag nginx:alpine frontend:$VERSION + - echo "Deployment completed" - name: confirm-deployment image: appleboy/drone-ssh