Create deploy.sh bash script to run the deployment
This commit is contained in:
parent
bea2441807
commit
f2559f1fe1
2 changed files with 32 additions and 14 deletions
|
|
@ -1,18 +1,18 @@
|
||||||
pipeline:
|
# pipeline:
|
||||||
build:
|
# build:
|
||||||
image: docker:dind
|
# image: docker:dind
|
||||||
privileged: true
|
# privileged: true
|
||||||
commands:
|
# commands:
|
||||||
- docker build -t frontend:${CI_COMMIT_SHA:0:8} .
|
# - docker build -t frontend:${CI_COMMIT_SHA:0:8} .
|
||||||
- docker tag frontend:${CI_COMMIT_SHA:0:8} frontend:latest
|
# - docker tag frontend:${CI_COMMIT_SHA:0:8} frontend:latest
|
||||||
|
|
||||||
deploy:
|
# deploy:
|
||||||
image: docker:dind
|
# image: docker:dind
|
||||||
privileged: true
|
# privileged: true
|
||||||
commands:
|
# commands:
|
||||||
- docker stop frontend || true
|
# - docker stop frontend || true
|
||||||
- docker rm frontend || true
|
# - docker rm frontend || true
|
||||||
- docker run -d --name frontend -p 5173:5173 frontend:latest
|
# - docker run -d --name frontend -p 5173:5173 frontend:latest
|
||||||
|
|
||||||
# clone:
|
# clone:
|
||||||
# git:
|
# git:
|
||||||
|
|
@ -32,4 +32,10 @@ pipeline:
|
||||||
# - docker rm frontend || true
|
# - docker rm frontend || true
|
||||||
# - docker run -d --name frontend -p 5137:5137 frontend:latest
|
# - docker run -d --name frontend -p 5137:5137 frontend:latest
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
deploy:
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- sh ./deploy.sh
|
||||||
|
|
||||||
branches: master
|
branches: master
|
||||||
12
deploy.sh
Normal file
12
deploy.sh
Normal file
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue