|
| 1 | +name: Build Docker image for chat (stg) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'v3' |
| 7 | + - 'clean-argocd' |
| 8 | + pull_request: |
| 9 | + # branches: [ "v3" ] |
| 10 | + types: [opened, synchronize, reopened, ready_for_review] |
| 11 | + paths: |
| 12 | + - 'apps/chat/**' |
| 13 | + - '.github/workflows/v3_chat**' |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +env: |
| 20 | + REGISTRY: ghcr.io |
| 21 | + IMAGE_NAME: ${{ github.repository }}/chat-arm |
| 22 | + |
| 23 | +jobs: |
| 24 | + build: |
| 25 | + if: github.event.pull_request.draft == false |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + packages: write |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v3 |
| 33 | + |
| 34 | + - name: Replace .env.production with .env.stg |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + rm apps/chat/.env.production |
| 38 | + mv apps/chat/.env.stg apps/chat/.env.production |
| 39 | +
|
| 40 | + - name: Set up QEMU |
| 41 | + uses: docker/setup-qemu-action@v2 |
| 42 | + |
| 43 | + - name: Set up Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v2 |
| 45 | + |
| 46 | + - name: Log into registry ${{ env.REGISTRY }} |
| 47 | + uses: docker/login-action@v2 |
| 48 | + with: |
| 49 | + registry: ${{ env.REGISTRY }} |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + |
| 53 | + - name: Extract Docker metadata |
| 54 | + id: meta |
| 55 | + uses: docker/metadata-action@v4 |
| 56 | + with: |
| 57 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 58 | + |
| 59 | + - name: Build and push Docker image |
| 60 | + uses: docker/build-push-action@v5 |
| 61 | + with: |
| 62 | + context: . |
| 63 | + file: apps/chat/Dockerfile |
| 64 | + push: ${{ github.event_name != 'pull_request' }} |
| 65 | + tags: ${{ steps.meta.outputs.tags }} |
| 66 | + platforms: linux/arm64 |
| 67 | + labels: ${{ steps.meta.outputs.labels }} |
| 68 | + build-args: | |
| 69 | + NEXT_PUBLIC_ENV=${{ startsWith(github.ref, 'refs/tags/') && 'production' || 'staging' }} |
0 commit comments