pianello-web-app/.woodpecker/.build.yml

26 lines
1.3 KiB
YAML
Raw Normal View History

2023-05-28 12:56:31 +02:00
pipeline:
2023-07-10 17:17:18 +02:00
build_and_deploy:
2023-05-31 20:44:50 +02:00
image: alpine:3.14
2023-07-10 17:30:51 +02:00
secrets: [docker_password, docker_username, runner_private_key]
2023-05-28 12:56:31 +02:00
commands:
2023-07-10 17:17:18 +02:00
- apk add --no-cache openssh docker docker-compose jq
################### Provisioning
- echo "$${DOCKER_PASSWORD}" | docker login --password-stdin --username "$${DOCKER_USERNAME}" git.webdeploy.it
2023-05-31 17:59:52 +02:00
- echo "TAG=$(jq -r .version ./package.json)" >> .env
2023-07-10 17:17:18 +02:00
- echo "ORIGIN=https://pianello.webdeploy.it" >> .env
- docker-compose -f docker-compose.build.yml build
- docker push git.webdeploy.it/pianello/frontend:latest
- docker push git.webdeploy.it/pianello/frontend:$(jq -r .version ./package.json)
# DEPLOY STUFF
2023-07-10 18:00:57 +02:00
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- printf "%s" "$${RUNNER_PRIVATE_KEY}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- ssh-add ~/.ssh/id_ed25519
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- cat .env | ssh pianello@pianello.webdeploy.it -p 11122 "cat - > .env" # copy env
- cat docker-compose.prod.yml | ssh pianello@pianello.webdeploy.it -p 11122 "cat - > docker-compose.yml && docker compose pull && docker compose stop && docker compose up -d --remove-orphans"
2023-05-28 12:56:31 +02:00
volumes:
- /var/run/docker.sock:/var/run/docker.sock
2023-07-10 17:17:18 +02:00
branches: main