Spaces:
Running
on
A100
Running
on
A100
AurelioAguirre
commited on
Commit
·
a4c773d
1
Parent(s):
c6de67d
Fixing Dockerfile v12
Browse files- Dockerfile +26 -13
- main/config.yaml +1 -0
Dockerfile
CHANGED
@@ -2,27 +2,40 @@
|
|
2 |
# Use Python 3.12 slim image as base
|
3 |
FROM python:3.12-slim
|
4 |
|
5 |
-
# Set
|
6 |
-
|
7 |
|
8 |
-
#
|
9 |
-
|
10 |
-
|
11 |
-
# Install dependencies
|
12 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
|
14 |
-
# Create necessary directories
|
15 |
RUN mkdir -p /app/logs /app/.cache /app/models \
|
16 |
&& chmod 777 /app/logs /app/.cache /app/models
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Set environment variables
|
23 |
-
ENV PYTHONPATH
|
24 |
ENV PYTHONUNBUFFERED=1
|
25 |
-
ENV HF_HOME
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# Expose the port (Hugging Face API runs on 7680)
|
28 |
EXPOSE 7680
|
|
|
2 |
# Use Python 3.12 slim image as base
|
3 |
FROM python:3.12-slim
|
4 |
|
5 |
+
# Set up a new user named "user" with user ID 1000
|
6 |
+
RUN useradd -m -u 1000 user
|
7 |
|
8 |
+
# Set home to the user's home directory and add local bin to PATH
|
9 |
+
ENV HOME=/home/user \
|
10 |
+
PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
11 |
|
12 |
+
# Create necessary directories first
|
13 |
RUN mkdir -p /app/logs /app/.cache /app/models \
|
14 |
&& chmod 777 /app/logs /app/.cache /app/models
|
15 |
|
16 |
+
# Set working directory to the user's app directory
|
17 |
+
WORKDIR $HOME/app
|
18 |
+
|
19 |
+
# Copy requirements first to leverage Docker cache
|
20 |
+
COPY --chown=user requirements.txt .
|
21 |
+
|
22 |
+
# Install dependencies as the user
|
23 |
+
USER user
|
24 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
25 |
+
pip install --no-cache-dir -r requirements.txt
|
26 |
+
|
27 |
+
# Copy the application code with correct ownership
|
28 |
+
COPY --chown=user main $HOME/app/main
|
29 |
+
COPY --chown=user utils $HOME/app/utils
|
30 |
|
31 |
# Set environment variables
|
32 |
+
ENV PYTHONPATH=$HOME/app/main
|
33 |
ENV PYTHONUNBUFFERED=1
|
34 |
+
ENV HF_HOME=$HOME/app/.cache
|
35 |
+
|
36 |
+
# Expose secret at buildtime if needed
|
37 |
+
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
38 |
+
export HF_TOKEN=$(cat /run/secrets/HF_TOKEN)
|
39 |
|
40 |
# Expose the port (Hugging Face API runs on 7680)
|
41 |
EXPOSE 7680
|
main/config.yaml
CHANGED
@@ -10,6 +10,7 @@ model:
|
|
10 |
temperature: 0.7
|
11 |
repetition_penalty: 1.1
|
12 |
defaults:
|
|
|
13 |
model_name: "huihui-ai/Qwen2.5-Coder-32B-Instruct-abliterated"
|
14 |
|
15 |
folders:
|
|
|
10 |
temperature: 0.7
|
11 |
repetition_penalty: 1.1
|
12 |
defaults:
|
13 |
+
#model_name: "huihui-ai/Llama-3.2-3B-Instruct-abliterated"
|
14 |
model_name: "huihui-ai/Qwen2.5-Coder-32B-Instruct-abliterated"
|
15 |
|
16 |
folders:
|