name: Build and publish Docker image on: push: branches: [main] tags: ["v*"] workflow_dispatch: env: REGISTRY: ${{ gitea.server_url }} IMAGE_NAME: ${{ gitea.repository }} jobs: build-and-push: runs-on: docker steps: - name: Checkout uses: actions/checkout@v4 - name: Install uv run: curl -LsSf https://astral.sh/uv/install.sh | sh - name: Download map assets (fonts, sprites, twemoji) run: uv run python -m pipeline.download.map_assets --output frontend/public/assets - name: Download arcgis data for finder run: uv run python -m pipeline.download.arcgis --output property-data/arcgis_data.parquet - name: Install Docker CLI run: | ARCH=$(uname -m) curl -fsSL "https://download.docker.com/linux/static/stable/${ARCH}/docker-27.5.1.tgz" \ | tar xz --strip-components=1 -C /usr/local/bin docker/docker docker --version - name: Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v3 - name: Log in to Forgejo Container Registry uses: https://github.com/docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ gitea.actor }} password: ${{ secrets.GITEA_TOKEN }} - name: Determine image tags id: tags run: | REPO=$(echo "${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') SHA_SHORT=$(echo "${{ gitea.sha }}" | cut -c1-7) TAGS="${{ env.REGISTRY }}/${REPO}:sha-${SHA_SHORT}" # Add latest tag on default branch if [ "${{ gitea.ref }}" = "refs/heads/main" ]; then TAGS="${TAGS},${{ env.REGISTRY }}/${REPO}:latest" fi # Add version tags for semver tags REF="${{ gitea.ref }}" if [[ "$REF" =~ ^refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then VERSION="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}" MINOR="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}" TAGS="${TAGS},${{ env.REGISTRY }}/${REPO}:${VERSION}" TAGS="${TAGS},${{ env.REGISTRY }}/${REPO}:${MINOR}" fi echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" echo "repo=${REPO}" >> "$GITHUB_OUTPUT" echo "sha_short=${SHA_SHORT}" >> "$GITHUB_OUTPUT" - name: Build and push uses: https://github.com/docker/build-push-action@v6 with: context: . push: true tags: ${{ steps.tags.outputs.tags }} cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}:buildcache,mode=max - name: Build and push screenshot service uses: https://github.com/docker/build-push-action@v6 with: context: ./screenshot push: true tags: | ${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-screenshot:latest ${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-screenshot:sha-${{ steps.tags.outputs.sha_short }} cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-screenshot:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-screenshot:buildcache,mode=max - name: Build and push finder service uses: https://github.com/docker/build-push-action@v6 with: context: . file: Dockerfile.finder push: true tags: | ${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-finder:latest ${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-finder:sha-${{ steps.tags.outputs.sha_short }} cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-finder:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.tags.outputs.repo }}-finder:buildcache,mode=max