Skip to content

Commit

Permalink
Merge pull request #56 from depot/normalize-name
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie authored Jan 6, 2025
2 parents 933c83b + fe250f5 commit 606e237
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bin/build-and-push-model
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ tag=${3:-latest}

annotations="annotation.org.opencontainers.image.revision=${sha},annotation.org.opencontainers.image.source=https://huggingface.co/${name},annotation-index.org.opencontainers.image.revision=${sha},annotation-index.org.opencontainers.image.source=https://huggingface.co/${name},annotation-manifest-descriptor.org.opencontainers.image.revision=${sha},annotation-manifest-descriptor.org.opencontainers.image.source=https://huggingface.co/${name}"

normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]')"

depot build . \
-f "${SCRIPT_DIR}/../models/Dockerfile" \
--platform linux/amd64,linux/arm64 \
--build-arg "MODEL=${name}" \
--build-arg "SHA=${sha}" \
--build-arg "SOURCE_DATE_EPOCH=0" \
--output "type=image,name=us-docker.pkg.dev/depot-gcp/depot-ai/$(echo "$name" | tr '[:upper:]' '[:lower:]'):${tag},push=true,compression=estargz,oci-mediatypes=true,force-compression=true,${annotations}" \
--output "type=image,name=us-docker.pkg.dev/depot-gcp/depot-ai/${normalized}:${tag},push=true,compression=estargz,oci-mediatypes=true,force-compression=true,${annotations}" \
--ssh "default=${SSH_AUTH_SOCK}" \
--progress plain
10 changes: 6 additions & 4 deletions website/src/components/Model.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {cx} from 'class-variance-authority'
import {SVGProps, useCallback, useEffect, useState} from 'react'
import {SVGProps, useCallback, useEffect, useMemo, useState} from 'react'
import {useCopyToClipboard} from '../hooks/useCopyToClipboard'

export interface ModelProps {
Expand All @@ -20,9 +20,11 @@ export function Model({name, sha, tagAs}: ModelProps) {
return () => clearTimeout(timeout)
}, [value])

const normalizedName = useMemo(() => name.toLowerCase(), [name])

const copyImage = useCallback(() => {
copy(`COPY --link --from=depot.ai/${name}:${tagAs} / .`)
}, [name, tagAs])
copy(`COPY --link --from=depot.ai/${normalizedName}:${tagAs} / .`)
}, [normalizedName, tagAs])

return (
<div className="bg-radix-mauve1 border border-radix-mauve6 px-4 rounded-lg gap-2 flex items-center leading-none justify-between">
Expand All @@ -36,7 +38,7 @@ export function Model({name, sha, tagAs}: ModelProps) {
/>
<div className="tracking-tight whitespace-nowrap md:text-lg py-4 overflow-x-scroll md:overflow-x-hidden overflow-y-hidden">
<span className="text-radix-mauve11">depot.ai/</span>
{name}
{normalizedName}
<span className="text-radix-mauve11">:{tagAs}</span>
</div>
</button>
Expand Down

0 comments on commit 606e237

Please sign in to comment.