2023-09-25 11:48:21 +02:00
|
|
|
steps:
|
2023-07-10 17:17:18 +02:00
|
|
|
build_and_deploy:
|
2023-09-25 17:31:36 +02:00
|
|
|
image: git.webdeploy.it/webdeploy/alpine
|
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
|
|
|
################### Provisioning
|
2023-09-25 17:44:09 +02:00
|
|
|
- echo "$${DOCKER_PASSWORD}" | docker login --password-stdin --username "$${DOCKER_USERNAME}" git.webdeploy.it
|
2023-07-10 18:39:52 +02:00
|
|
|
- echo "TAG=$(jq -r .version ./frontend/package.json)" >> .env
|
2023-07-10 17:17:18 +02:00
|
|
|
- echo "ORIGIN=https://pianello.webdeploy.it" >> .env
|
2023-12-27 12:15:08 +01:00
|
|
|
- echo "PUBLIC_BACKEND_URL=https://ale-dev.teck-developer.com" >> ./frontend/.env
|
2023-09-25 17:31:36 +02:00
|
|
|
- docker-compose -f docker-compose.build.yml build
|
2023-07-10 17:17:18 +02:00
|
|
|
- docker push git.webdeploy.it/pianello/frontend:latest
|
2023-07-10 18:39:52 +02:00
|
|
|
- docker push git.webdeploy.it/pianello/frontend:$(jq -r .version ./frontend/package.json)
|
2023-12-29 10:55:45 +01:00
|
|
|
#### Deploy
|
|
|
|
- config_ssh.sh "$${RUNNER_PRIVATE_KEY}"
|
2023-07-10 18:00:57 +02:00
|
|
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
2023-07-10 19:00:07 +02:00
|
|
|
- cat .env | ssh pianello@pianello.webdeploy.it "cat - > .env" # copy env
|
2023-09-25 17:47:29 +02:00
|
|
|
- cat docker-compose.prod.yml | ssh pianello@pianello.webdeploy.it "cat - > docker-compose.yml && docker compose pull && docker compose up -d --remove-orphans"
|
2023-05-28 12:56:31 +02:00
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
|
2023-09-25 11:48:21 +02:00
|
|
|
when:
|
|
|
|
branch: main
|