-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
36 lines (30 loc) · 1.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM debian:12-slim as downloader
# Specify the huggingface model such as microsoft/resnet-50
# depot build
# --build-arg="MODEL=microsoft/resnet-50"
# --build-arg="SHA=4067a2728b9c93fbd67b9d5a30b03495ac74a46e
# --output=type=image,name=depot.ai/microsoft/resnet-50:latest,push=true,compression=estargz,oci-mediatypes=true
# --provenance=false .
ARG MODEL
ARG SHA
ARG SOURCE_DATE_EPOCH
RUN apt-get update \
&& apt-get install -y --no-install-recommends git-lfs=3.3.0-1+b5 ca-certificates openssh-client \
&& git lfs install \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV GIT_LFS_SKIP_SMUDGE=1
RUN --mount=type=ssh \
set -x && \
mkdir -p ~/.ssh && \
ssh-keyscan hf.co >> ~/.ssh/known_hosts && \
git clone [email protected]:${MODEL} /model && \
cd /model && \
git reset --hard ${SHA} && \
git lfs pull && \
rm -rf .git .gitattributes && \
find . -newermt "@${SOURCE_DATE_EPOCH}" -writable -xdev | xargs touch --date="@${SOURCE_DATE_EPOCH}" --no-dereference
FROM scratch as model
LABEL org.opencontainers.image.source="https://huggingface.co/$MODEL"
LABEL org.opencontainers.image.revision="$SHA"
COPY --from=downloader /model /