2024-06-19 03:35:56 -04:00
|
|
|
name: Build and Push Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
- "dev"
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Docker
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
2024-06-23 20:55:35 -04:00
|
|
|
- name: Extract metadata for API
|
2024-06-19 03:35:56 -04:00
|
|
|
uses: docker/metadata-action@v5
|
2024-06-23 20:55:35 -04:00
|
|
|
id: meta-api
|
2024-06-19 03:35:56 -04:00
|
|
|
with:
|
2024-06-19 04:35:43 -04:00
|
|
|
images: vontainment/v-firecrawl
|
2024-06-19 03:35:56 -04:00
|
|
|
flavor: latest=false
|
|
|
|
tags: |
|
2024-06-23 20:55:35 -04:00
|
|
|
type=raw,value=main,enable=${{ gitea.ref == 'refs/heads/main' }}
|
|
|
|
type=raw,value=dev,enable=${{ gitea.ref == 'refs/heads/dev' }}
|
|
|
|
type=sha,priority=100,enable=${{ gitea.event_name == 'push' }}
|
2024-06-19 03:35:56 -04:00
|
|
|
|
2024-06-23 20:55:35 -04:00
|
|
|
- name: Extract metadata for Playwright Service
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
id: meta-playwright
|
|
|
|
with:
|
|
|
|
images: vontainment/v-playwright
|
|
|
|
flavor: latest=false
|
|
|
|
tags: |
|
|
|
|
type=raw,value=main,enable=${{ gitea.ref == 'refs/heads/main' }}
|
|
|
|
type=raw,value=dev,enable=${{ gitea.ref == 'refs/heads/dev' }}
|
|
|
|
type=sha,priority=100,enable=${{ gitea.event_name == 'push' }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image (API)
|
2024-06-19 03:35:56 -04:00
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
2024-06-19 04:35:43 -04:00
|
|
|
context: ./apps/api
|
|
|
|
file: ./apps/api/Dockerfile
|
2024-06-19 03:35:56 -04:00
|
|
|
push: true
|
2024-06-23 20:55:35 -04:00
|
|
|
tags: ${{ steps.meta-api.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta-api.outputs.labels }}
|
|
|
|
cache-from: type=local,src=/opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build/
|
|
|
|
cache-to: type=local,dest=/opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build-new/
|
|
|
|
|
|
|
|
- name: Build and push Docker image (Playwright Service)
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: ./apps/playwright-service
|
|
|
|
file: ./apps/playwright-service/Dockerfile
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta-playwright.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta-playwright.outputs.labels }}
|
|
|
|
cache-from: type=local,src=/opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build/
|
|
|
|
cache-to: type=local,dest=/opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build-new/
|
2024-06-19 04:35:43 -04:00
|
|
|
|
|
|
|
- name: Rotate build cache
|
|
|
|
run: |
|
2024-06-23 20:55:35 -04:00
|
|
|
rm -rf /opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build/
|
|
|
|
mv /opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build-new/ /opt/hostedtoolcache/${{ gitea.repository }}-${{ gitea.ref_name }}/build/
|