Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
name: Docker Image CI
|
|
|
|
on:
|
|
push:
|
|
branches: ['main', 'develop']
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository_owner }}/hosted-gateway-frontend:${{ github.ref_name }}
|
|
ghcr.io/${{ github.repository_owner }}/hosted-gateway-frontend:${{ github.sha }}
|
|
build-args: |
|
|
VITE_API_URL=https://api.t4t-gateway.com
|
|
VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }}
|
|
VITE_COMMIT_SHA=${{ github.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: docker stack deploy
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
username: root
|
|
host: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
key: ${{ secrets.SSH_PRIV_KEY }}
|
|
script: |
|
|
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
docker stack deploy -c ~/devops/hostinger/prod-stack.yaml prod --with-registry-auth --resolve-image always
|
|
docker image prune -f --filter "until=24h"
|