mnisyif_frontend/.woodpecker.yml

83 lines
No EOL
2.4 KiB
YAML

# 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
# clone:
# git:
# image: woodpeckerci/plugin-git
# settings:
# depth: 1
# pipeline:
# build_and_deploy:
# image: docker:dind
# privileged: true
# commands:
# - sleep 5 # Give Docker daemon time to start
# - docker build -t frontend:${CI_COMMIT_SHA:0:8} .
# - docker tag frontend:${CI_COMMIT_SHA:0:8} frontend:latest
# - docker stop frontend || true
# - docker rm frontend || true
# - docker run -d --name frontend -p 5137:5137 frontend:latest
# pipeline:
# deploy:
# image: alpine
# commands:
# - sh ./deploy.sh
# branches: master
pipeline:
submodules:
image: alpine/git
commands:
- git submodule update --init --recursive
build:
image: docker:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- cd frontend
- docker build -t mnisyif-frontend .
# Optionally push to a registry
# - docker tag my-frontend-app my-registry/my-frontend-app:latest
# - docker push my-registry/my-frontend-app:latest
deploy:
image: appleboy/drone-ssh
environment:
HOST: "10.0.0.2"
USER: "mnisyif"
SSH_KEY:
from_secret: ssh_key
commands:
- apk add --no-cache openssh
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
- scp frontend/docker-compose.yml $USER@$HOST:/docker-containers/mnisyif
- scp -r frontend/* $USER@$HOST:/docker-containers/mnisyif/frontend/
# If the image is pushed to a registry, pull it on the deployment server
# - ssh $USER@$HOST "cd /path/to/deployment/directory && docker-compose pull && docker-compose up -d"
# If the image is built locally on the CI server, transfer the image file
# - docker save my-frontend-app | bzip2 | ssh $USER@$HOST 'bunzip2 | docker load'
# - ssh $USER@$HOST "cd /path/to/deployment/directory && docker-compose up -d"
secrets:
ssh_key:
external: true