Добавил комменты #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image Builder | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'nginx/**' | |
- 'mysql/**' | |
- 'deploy_manager/**' | |
- 'sshproxy/**' | |
- 'bx_installer/**' | |
- 'httpd/**' | |
- 'adminer/**' | |
- 'docker-compose.build.yml' | |
- 'docker-compose.main_proxy.yml' | |
jobs: | |
docker-build: | |
name: Сборка и пуш образов в Github Registry Packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker login | |
env: | |
DOCKER_USER: ${{ secrets.DOCKER_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD ghcr.io | |
- name: Docker build | |
run: | |
docker-compose -f docker-compose.build.yml build --parallel | |
- name: Push containers | |
run: | |
docker-compose -f docker-compose.build.yml push | |
deploy: | |
name: Деплой на сервер | |
runs-on: ubuntu-latest | |
steps: | |
- name: Пул Докер образов, git pull и перезапуск сервера | |
uses: appleboy/ssh-action@v0.1.10 | |
env: | |
DEPLOY_ENV_PATH: ${{ secrets.DOCKER_ENV_PATH }} | |
NEED_DEPLOY: ${{ env.NEED_DEPLOY }} | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
script_stop: true | |
script: | | |
cd $DEPLOY_ENV_PATH | |
zsh sandbox stop | |
git reset --hard | |
git pull | |
zsh sandbox pull_proxy | |
zsh sandbox start |