Nikolai X. Shadeuxs
6e8c2f2f1b
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
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 }}
|
|
|
|
- name: Extract metadata
|
|
uses: docker/metadata-action@v5
|
|
id: meta
|
|
with:
|
|
images: vontainment/v-firecrawl
|
|
flavor: latest=false
|
|
tags: |
|
|
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
|
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
type=sha,priority=100,enable=${{ github.event_name == 'push' }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./apps/api
|
|
file: ./apps/api/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=local,src=/opt/hostedtoolcache/${{ github.repository }}-${{ github.ref_name }}/build/
|
|
cache-to: type=local,dest=/opt/hostedtoolcache/${{ github.repository }}-${{ github.ref_name }}/build-new/
|
|
|
|
- name: Rotate build cache
|
|
run: |
|
|
rm -rf /opt/hostedtoolcache/${{ github.repository }}-${{ github.ref_name }}/build/
|
|
mv /opt/hostedtoolcache/${{ github.repository }}-${{ github.ref_name }}/build-new/ /opt/hostedtoolcache/${{ github.repository }}-${{ github.ref_name }}/build/
|