Repository navigation
fix: drop the NLTK data download from both images (#329) #122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Dev Images Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths-ignore: | |
| - 'README.md' | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| - target: main | |
| file: Dockerfile | |
| image_name: librechat-rag-api-dev | |
| - target: lite | |
| file: Dockerfile.lite | |
| image_name: librechat-rag-api-dev-lite | |
| steps: | |
| # Free up disk space | |
| - name: Free Disk Space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| # Check out the repository | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Set up QEMU | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Set up Docker Buildx | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Registry names must be lowercase, and the repository owner is not guaranteed to be. | |
| - name: Resolve image name | |
| env: | |
| IMAGE_NAME: ${{ matrix.image_name }} | |
| run: printf 'GHCR_IMAGE=ghcr.io/%s/%s\n' "${GITHUB_REPOSITORY_OWNER,,}" "$IMAGE_NAME" >> "$GITHUB_ENV" | |
| # Build and push Docker images for each target | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ${{ matrix.file }} | |
| push: true | |
| tags: | | |
| ${{ env.GHCR_IMAGE }}:${{ github.sha }} | |
| ${{ env.GHCR_IMAGE }}:latest | |
| platforms: linux/amd64,linux/arm64 | |
| target: ${{ matrix.target }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # After the repository moves to another owner, deployments still pull the old | |
| # GHCR namespace. Copying each published tag there keeps them updating until the | |
| # deprecation window closes. Copies are cross-repo blob mounts within GHCR, so no | |
| # image data is rebuilt or re-uploaded. | |
| # | |
| # Set the LEGACY_GHCR_OWNER variable and the LEGACY_GHCR_TOKEN secret (a token with | |
| # write:packages for that owner) to turn this on. It stays off when either is unset, | |
| # and while the owner still matches the one publishing the images. | |
| - name: Mirror tags to the legacy namespace | |
| if: ${{ vars.LEGACY_GHCR_OWNER != '' }} | |
| continue-on-error: true | |
| env: | |
| LEGACY_OWNER: ${{ vars.LEGACY_GHCR_OWNER }} | |
| LEGACY_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }} | |
| TAGS: "${{ github.sha }} latest" | |
| run: | | |
| set -euo pipefail | |
| legacy_owner="${LEGACY_OWNER,,}" | |
| if [ "$legacy_owner" = "${GITHUB_REPOSITORY_OWNER,,}" ]; then | |
| echo "Legacy owner matches the current owner; nothing to mirror." | |
| exit 0 | |
| fi | |
| if [ -z "$LEGACY_TOKEN" ]; then | |
| echo "::warning::LEGACY_GHCR_OWNER is set but LEGACY_GHCR_TOKEN is not; skipping the mirror." | |
| exit 0 | |
| fi | |
| # The pull side needs this login too: it replaces the GITHUB_TOKEN credential | |
| # for ghcr.io, and both namespaces are read with it. | |
| echo "$LEGACY_TOKEN" | docker login ghcr.io -u "$legacy_owner" --password-stdin | |
| legacy_image="ghcr.io/${legacy_owner}/${GHCR_IMAGE##*/}" | |
| for tag in $TAGS; do | |
| echo "Mirroring ${GHCR_IMAGE}:${tag} -> ${legacy_image}:${tag}" | |
| docker buildx imagetools create -t "${legacy_image}:${tag}" "${GHCR_IMAGE}:${tag}" | |
| done |