Actualiser .gitea/workflows/docker.yml
Remise en état build backend
This commit is contained in:
@@ -13,6 +13,95 @@ env:
|
|||||||
IMAGE_FRONTEND: audio-classifier-frontend
|
IMAGE_FRONTEND: audio-classifier-frontend
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
build-backend:
|
||||||
|
name: Build Backend Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Download Essentia models
|
||||||
|
run: |
|
||||||
|
mkdir -p backend/models
|
||||||
|
cd backend/models
|
||||||
|
|
||||||
|
# Download models from Essentia
|
||||||
|
echo "Downloading Essentia models..."
|
||||||
|
|
||||||
|
# Embedding model (18 MB)
|
||||||
|
curl -L -o discogs-effnet-bs64-1.pb \
|
||||||
|
https://essentia.upf.edu/models/feature-extractors/discogs-effnet/discogs-effnet-bs64-1.pb
|
||||||
|
|
||||||
|
# Genre classifier (2 MB)
|
||||||
|
curl -L -o genre_discogs400-discogs-effnet-1.pb \
|
||||||
|
https://essentia.upf.edu/models/classification-heads/genre_discogs400/genre_discogs400-discogs-effnet-1.pb
|
||||||
|
|
||||||
|
# Genre metadata
|
||||||
|
curl -L -o genre_discogs400-discogs-effnet-1.json \
|
||||||
|
https://essentia.upf.edu/models/classification-heads/genre_discogs400/genre_discogs400-discogs-effnet-1.json
|
||||||
|
|
||||||
|
# Mood classifier (2.7 MB)
|
||||||
|
curl -L -o mtg_jamendo_moodtheme-discogs-effnet-1.pb \
|
||||||
|
https://essentia.upf.edu/models/classification-heads/mtg_jamendo_moodtheme/mtg_jamendo_moodtheme-discogs-effnet-1.pb
|
||||||
|
|
||||||
|
# Instrument classifier (2.6 MB)
|
||||||
|
curl -L -o mtg_jamendo_instrument-discogs-effnet-1.pb \
|
||||||
|
https://essentia.upf.edu/models/classification-heads/mtg_jamendo_instrument/mtg_jamendo_instrument-discogs-effnet-1.pb
|
||||||
|
|
||||||
|
# Genre classifier alternative (2.7 MB)
|
||||||
|
curl -L -o mtg_jamendo_genre-discogs-effnet-1.pb \
|
||||||
|
https://essentia.upf.edu/models/classification-heads/mtg_jamendo_genre/mtg_jamendo_genre-discogs-effnet-1.pb
|
||||||
|
|
||||||
|
ls -lh
|
||||||
|
echo "Models downloaded successfully!"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Determine version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
if [[ "${{ gitea.ref }}" == refs/tags/v* ]]; then
|
||||||
|
echo "VERSION=${GITEA_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "VERSION=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ gitea.repository_owner }}/${{ env.IMAGE_BACKEND }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=raw,value=latest,enable=${{ startsWith(gitea.ref, 'refs/tags/v') }}
|
||||||
|
type=raw,value=dev,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||||
|
type=sha,prefix=dev-,format=short,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||||
|
|
||||||
|
- name: Build and push backend
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
push: true
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ steps.version.outputs.VERSION }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ gitea.repository_owner }}/${{ env.IMAGE_BACKEND }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ gitea.repository_owner }}/${{ env.IMAGE_BACKEND }}:buildcache,mode=max
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
name: Build Frontend Image
|
name: Build Frontend Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
Reference in New Issue
Block a user