Refactor GitHub Actions workflow for Docker deployment
Some checks failed
Build & Deploy Web & Bot / Build and Push to Docker Hub (push) Has been cancelled
Build & Deploy Web & Bot / Deploy to VPS (push) Has been cancelled

- 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.
This commit is contained in:
vchikalkin 2025-06-27 23:16:26 +03:00
parent aa8521fec7
commit 4a13044d3e

View File

@ -13,30 +13,29 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Docker Buildx - name: Set up Docker
uses: docker/setup-buildx-action@v3 run: |
sudo apt-get update
sudo apt-get install -y docker.io
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push web image - name: Build web image
uses: docker/build-push-action@v5 run: |
with: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest -f ./apps/web/Dockerfile .
context: .
file: ./apps/web/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest
- name: Build and push bot image - name: Push web image to Docker Hub
uses: docker/build-push-action@v5 run: |
with: docker push ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest
context: .
file: ./apps/bot/Dockerfile - name: Build bot image
push: true run: |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest 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: deploy:
name: Deploy to VPS name: Deploy to VPS