From 4a13044d3e25ed856ab0299a39b906f861374261 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 27 Jun 2025 23:16:26 +0300 Subject: [PATCH] Refactor GitHub Actions workflow for Docker deployment - Replace Docker Buildx setup with direct Docker installation. - Update Docker Hub login method to use command line. - Separate build and push steps for web and bot images for clarity and maintainability. --- .github/workflows/deploy.yml | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5cc5316..f255d6a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,30 +13,29 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker + run: | + sudo apt-get update + sudo apt-get install -y docker.io - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin - - name: Build and push web image - uses: docker/build-push-action@v5 - with: - context: . - file: ./apps/web/Dockerfile - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest + - name: Build web image + run: | + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest -f ./apps/web/Dockerfile . - - name: Build and push bot image - uses: docker/build-push-action@v5 - with: - context: . - file: ./apps/bot/Dockerfile - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest + - name: Push web image to Docker Hub + run: | + docker push ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest + + - name: Build bot image + run: | + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest -f ./apps/bot/Dockerfile . + + - name: Push bot image to Docker Hub + run: | + docker push ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest deploy: name: Deploy to VPS