Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push monobase and monobase-runtime images to r8.im #37

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 57 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
jobs:
check:
name: Check
runs-on: ubuntu-latest
runs-on: ubuntu-latest-4-cores
env:
R8_CUDA_PREFIX: ${{ secrets.R8_CUDA_PREFIX }}
R8_CUDNN_PREFIX: ${{ secrets.R8_CUDNN_PREFIX }}
Expand Down Expand Up @@ -51,34 +51,66 @@ jobs:
- run: ./script/build
- run: ./script/test-mini

build-release-monobase:
if: ${{ github.event_name != 'pull_request' }}
name: Build + release monobase image
needs:
- check
- test
- test-mini
permissions:
contents: read
id-token: write
uses: replicate/actions/.github/workflows/buildx.yml@main
with:
image: monobase
fetch-depth: 0
build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1

build-release-monobase-runtime:
if: ${{ github.event_name != 'pull_request' }}
name: Build + release monobase-runtime image
build-release:
name: Build + release ${{ matrix.image.name }} image
needs:
- check
- test
- test-mini
permissions:
contents: read
id-token: write
uses: replicate/actions/.github/workflows/buildx.yml@main
with:
image: monobase-runtime
file: runtime.Dockerfile
fetch-depth: 0
strategy:
matrix:
image:
- name: monobase
- name: monobase-runtime
file: runtime.Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
us-docker.pkg.dev/replicate-production/replicate-us/${{ matrix.image.name }}
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}},priority=0
labels: |
org.opencontainers.image.title=${{ matrix.image.name }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/1025538909507/locations/global/workloadIdentityPools/github/providers/github-actions
service_account: [email protected]
token_format: access_token
- name: Log into US Artifact Registry
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}'
file: ${{ matrix.image.file || '' }}
# push: ${{ github.event_name != 'pull_request' }}
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image.name }}
cache-to: type=gha,scope=${{ matrix.image.name }},mode=max
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ WORKDIR /src
ADD . .
ENV UV_LINK_MODE=copy
RUN if $(git rev-parse --is-shallow-repository); then git fetch --unshallow; fi \
&& git describe --always --dirty --tags \
&& uv build --sdist
&& GIT_DESC="$(git describe --always --dirty --tags)" \
&& if [ "$(echo "${GIT_DESC}" | cut -c1-10)" = 'refs/pull/' ]; then \
export SETUPTOOLS_SCM_PRETEND_VERSION='v0.0.0.dev+pr'; \
fi \
&& echo "GIT_DESC=${GIT_DESC}" \
&& echo "SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}" \
&& uv build

FROM ubuntu:jammy

Expand Down
Loading