Spaces:
Running
Running
update docker files for spaces deployment
Browse files- Dockerfile +14 -3
- docker-compose.yml +3 -0
Dockerfile
CHANGED
@@ -2,11 +2,13 @@ FROM python:3.10-slim
|
|
2 |
|
3 |
# Add build argument
|
4 |
ARG HUGGINGFACE_API_KEY
|
|
|
5 |
|
6 |
# System dependencies
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
build-essential \
|
9 |
curl \
|
|
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
# Set working directory
|
@@ -19,9 +21,18 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
19 |
# Copy project files
|
20 |
COPY . .
|
21 |
|
22 |
-
# Environment variables
|
23 |
-
ENV PYTHONUNBUFFERED=1
|
24 |
-
ENV HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
# Expose port
|
27 |
EXPOSE 7860
|
|
|
2 |
|
3 |
# Add build argument
|
4 |
ARG HUGGINGFACE_API_KEY
|
5 |
+
ENV HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
|
6 |
|
7 |
# System dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
build-essential \
|
10 |
curl \
|
11 |
+
git \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
# Set working directory
|
|
|
21 |
# Copy project files
|
22 |
COPY . .
|
23 |
|
24 |
+
# # Environment variables
|
25 |
+
# ENV PYTHONUNBUFFERED=1
|
26 |
+
# ENV HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
|
27 |
+
|
28 |
+
# HuggingFace login at container startup
|
29 |
+
# RUN --mount=type=secret,id=hf_token \
|
30 |
+
# HUGGINGFACE_API_KEY=$(cat /run/secrets/hf_token) && \
|
31 |
+
# huggingface-cli login --token $HUGGINGFACE_API_KEY
|
32 |
+
|
33 |
+
RUN mkdir -p ~/.huggingface && \
|
34 |
+
echo "${HUGGINGFACE_API_KEY}" > ~/.huggingface/token && \
|
35 |
+
huggingface-cli login --token ${HUGGINGFACE_API_KEY}
|
36 |
|
37 |
# Expose port
|
38 |
EXPOSE 7860
|
docker-compose.yml
CHANGED
@@ -8,7 +8,10 @@ services:
|
|
8 |
ports:
|
9 |
- "7860:7860"
|
10 |
environment:
|
|
|
11 |
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
|
|
|
|
|
12 |
deploy:
|
13 |
resources:
|
14 |
reservations:
|
|
|
8 |
ports:
|
9 |
- "7860:7860"
|
10 |
environment:
|
11 |
+
# - PYTHONUNBUFFERED=1
|
12 |
- HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
|
13 |
+
secrets:
|
14 |
+
- hf_token
|
15 |
deploy:
|
16 |
resources:
|
17 |
reservations:
|