Spaces:
Runtime error
Runtime error
Archie Wood
commited on
Commit
•
c6f43ec
1
Parent(s):
42d916e
reorg stuff
Browse files- Dockerfile +18 -14
Dockerfile
CHANGED
@@ -1,13 +1,5 @@
|
|
1 |
FROM node:20-alpine AS builder
|
2 |
|
3 |
-
# Install python3 and pip
|
4 |
-
RUN apk add --no-cache python3 py3-pip
|
5 |
-
|
6 |
-
# Create and activate a virtual environment
|
7 |
-
RUN python3 -m venv /venv
|
8 |
-
ENV PATH="/venv/bin:$PATH"
|
9 |
-
|
10 |
-
RUN pip install --upgrade "huggingface_hub[cli]"
|
11 |
|
12 |
# Build the app
|
13 |
WORKDIR /usr/app
|
@@ -15,16 +7,28 @@ COPY ./ /usr/app
|
|
15 |
RUN npm install
|
16 |
RUN npm run sources && npm run build
|
17 |
|
18 |
-
|
19 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
ARG STATIC_SPACE
|
21 |
-
|
22 |
-
|
23 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
24 |
huggingface-cli download --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space --local-dir=/usr/app/build $STATIC_SPACE README.md && rm -rf /usr/app/build/.cache
|
25 |
-
|
26 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
27 |
huggingface-cli upload --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space $STATIC_SPACE /usr/app/build . --delete "*"
|
28 |
|
29 |
-
|
30 |
CMD ["true"]
|
|
|
1 |
FROM node:20-alpine AS builder
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Build the app
|
5 |
WORKDIR /usr/app
|
|
|
7 |
RUN npm install
|
8 |
RUN npm run sources && npm run build
|
9 |
|
10 |
+
|
11 |
+
# Upload the app
|
12 |
+
|
13 |
+
## Install python3 and pip
|
14 |
+
RUN apk add --no-cache python3 py3-pip
|
15 |
+
|
16 |
+
## Create and activate a virtual environment
|
17 |
+
RUN python3 -m venv /venv
|
18 |
+
ENV PATH="/venv/bin:$PATH"
|
19 |
+
|
20 |
+
RUN pip install --upgrade "huggingface_hub[cli]"
|
21 |
+
|
22 |
+
## The site space name must be passed as an environment variable
|
23 |
+
## https://huggingface.co/docs/hub/spaces-sdks-docker#buildtime
|
24 |
ARG STATIC_SPACE
|
25 |
+
## The Hugging Face token must be passed as a secret (https://huggingface.co/docs/hub/spaces-sdks-docker#buildtime)
|
26 |
+
## 1. get README.md from the site space
|
27 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
28 |
huggingface-cli download --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space --local-dir=/usr/app/build $STATIC_SPACE README.md && rm -rf /usr/app/build/.cache
|
29 |
+
## 2. upload the new build to the site space, including README.md
|
30 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
31 |
huggingface-cli upload --token=$(cat /run/secrets/HF_TOKEN) --repo-type=space $STATIC_SPACE /usr/app/build . --delete "*"
|
32 |
|
33 |
+
## Halt execution because the code space is not meant to run.
|
34 |
CMD ["true"]
|