diff --git a/.github/workflows/build-bases.yaml b/.github/workflows/build-bases.yaml deleted file mode 100644 index a7186238d..000000000 --- a/.github/workflows/build-bases.yaml +++ /dev/null @@ -1,173 +0,0 @@ -name: Build Base Images - -on: - workflow_dispatch: - branches: - - main - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -env: - REGISTRY: ghcr.io - REGISTRY_NAMESPACE: replicate/cog - -jobs: - build-python: - name: Build & verify python package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # needed for setuptools_scm version determination - - uses: hynek/build-and-inspect-python-package@v2 - - generate-matrix: - runs-on: ubuntu-latest - needs: build-python - outputs: - matrix: ${{ steps.matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # needed for goreleaser version determination - - name: Download pre-built packages - uses: actions/download-artifact@v4 - with: - name: Packages - path: dist - - name: Set COG_WHEEL - run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - name: Build - run: make base-image - - id: matrix - run: | - MATRIX_JSON=$(./base-image generate-matrix) - echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT - shell: bash - - name: Check matrix - run: jq . <<< '${{ steps.matrix.outputs.matrix }}' - - build: - name: Build and Push Image - needs: generate-matrix - runs-on: ubuntu-latest-8-cores - strategy: - # TODO: Right Size this, 5 seems like a sane placeholder - max-parallel: 5 - matrix: - include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} - permissions: - contents: 'read' - packages: 'write' - - outputs: - image: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.title'] }}:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # needed for goreleaser version determination - - name: Set up Buildx - uses: docker/setup-buildx-action@v3 - with: - platforms: linux/amd64,linux/arm64 - driver-opts: | - image=moby/buildkit:v0.13.1 - - name: Download pre-built packages - uses: actions/download-artifact@v4 - with: - name: Packages - path: dist - - name: Set COG_WHEEL - run: echo COG_WHEEL=$(ls dist/*.whl) >>"$GITHUB_ENV" - - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - name: Build - run: make base-image - - - name: 'Set Python Version' - run: | - if [ -z "${{ matrix.python_version }}" ]; then - echo "::error::Python Version is Required" - exit 1 - fi - echo "PYTHON_VERSION=${{ matrix.python_version }}" >> $GITHUB_ENV - shell: bash - - - name: 'Set Cuda Version' - run: | - if [ ! -z "${{ matrix.cuda_version }}" ]; then - echo "CUDA_VERSION_ARG=--cuda ${{ matrix.cuda_version }}" >> $GITHUB_ENV - fi - shell: bash - - - name: 'Set Torch Version' - run: | - if [ ! -z "${{ matrix.torch_version }}" ]; then - echo "TORCH_VERSION_ARG=--torch ${{ matrix.torch_version }}" >> $GITHUB_ENV - fi - shell: bash - - - name: 'Generate Dockerfile' - run: | - ./base-image dockerfile \ - --python ${{ env.PYTHON_VERSION }} \ - ${{ env.CUDA_VERSION_ARG }} \ - ${{ env.TORCH_VERSION_ARG }} > Dockerfile - - - name: 'DockerFile Short Hash' - run: | - SHORT_HASH=$(echo ${{ hashFiles('Dockerfile') }} | cut -c1-8) - echo "Short Hash: $SHORT_HASH" - echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV - - - name: 'Authenticate to GHCR' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: 'Reproducible Build: Cache var-cache-apt' - id: cache-var-cache-apt - uses: actions/cache@v4 - with: - path: var-cache-apt-${{ env.RUNNER_ARCH }} - key: var-cache-apt-${{ env.RUNNER_ARCH }}-${{ env.SHORT_HASH }} - - name: 'Reproducible Build: inject var-cache-apt' - uses: reproducible-containers/buildkit-cache-dance@v3.1.2 - with: - cache-source: var-cache-apt-${{ env.RUNNER_ARCH }} - cache-target: /var/cache/apt - skip-extraction: ${{ steps.cache-var-cache-apt.outputs.cache-hit == 'true' }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/${{ matrix.image_name }} - tags: | - type=raw,value=${{ matrix.image_tag }},priority=800 - type=raw,value=${{ env.SHORT_HASH }} - - - name: 'Build and Push Base Images' - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - push: true - outputs: type=image,rewrite-timestamp=true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64 - cache-from: type=gha,scope=${{ matrix.image_name }}-${{ matrix.image_tag }} - cache-to: type=gha,scope=${{ matrix.image_name }}-${{ matrix.image_tag }},mode=max - env: - SOURCE_DATE_EPOCH: 0