From f2559f1fe1eb8fa80e2c90308502e37251df32da Mon Sep 17 00:00:00 2001 From: Murtadha Date: Thu, 11 Jul 2024 23:18:49 -0400 Subject: [PATCH] Create deploy.sh bash script to run the deployment --- .woodpecker.yml | 34 ++++++++++++++++++++-------------- deploy.sh | 12 ++++++++++++ 2 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 deploy.sh diff --git a/.woodpecker.yml b/.woodpecker.yml index 601d00f..ec10c73 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,18 +1,18 @@ -pipeline: - build: - image: docker:dind - privileged: true - commands: - - docker build -t frontend:${CI_COMMIT_SHA:0:8} . - - docker tag frontend:${CI_COMMIT_SHA:0:8} frontend:latest +# pipeline: +# build: +# image: docker:dind +# privileged: true +# commands: +# - docker build -t frontend:${CI_COMMIT_SHA:0:8} . +# - docker tag frontend:${CI_COMMIT_SHA:0:8} frontend:latest - deploy: - image: docker:dind - privileged: true - commands: - - docker stop frontend || true - - docker rm frontend || true - - docker run -d --name frontend -p 5173:5173 frontend:latest +# deploy: +# image: docker:dind +# privileged: true +# commands: +# - docker stop frontend || true +# - docker rm frontend || true +# - docker run -d --name frontend -p 5173:5173 frontend:latest # clone: # git: @@ -32,4 +32,10 @@ pipeline: # - docker rm frontend || true # - docker run -d --name frontend -p 5137:5137 frontend:latest +pipeline: + deploy: + image: alpine + commands: + - sh ./deploy.sh + branches: master \ No newline at end of file diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..d405662 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +# Build the Docker image +docker build -t frontend:latest . + +# Stop and remove the existing container +docker stop frontend || true +docker rm frontend || true + +# Run the new container +docker run -d --name frontend -p 5173:5173 frontend:latest \ No newline at end of file