Spaces:
Paused
Paused
Commit
·
50a5908
1
Parent(s):
d2b58f8
Added Dockerfile
Browse files- Dockerfile +42 -0
Dockerfile
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.12.8
|
2 |
+
|
3 |
+
# Set environment variables for Hugging Face, Transformers, and Matplotlib caches
|
4 |
+
ENV HF_HOME=/tmp/huggingface_cache \
|
5 |
+
TRANSFORMERS_CACHE=/tmp/transformers_cache \
|
6 |
+
MPLCONFIGDIR=/tmp/matplotlib_cache
|
7 |
+
|
8 |
+
# Pass Hugging Face token as a build argument
|
9 |
+
ARG HF_TOKEN
|
10 |
+
ENV HF_TOKEN=${HF_TOKEN}
|
11 |
+
|
12 |
+
# Install necessary system dependencies
|
13 |
+
RUN apt-get update && apt-get install -y \
|
14 |
+
libsystemd-dev \
|
15 |
+
libdbus-1-dev \
|
16 |
+
libgirepository1.0-dev \
|
17 |
+
libcairo2-dev \
|
18 |
+
python3-dev \
|
19 |
+
fontconfig \
|
20 |
+
&& rm -rf /var/lib/apt/lists/*
|
21 |
+
|
22 |
+
# Create writable directories for output and cache
|
23 |
+
RUN mkdir -p /app/output /tmp/huggingface_cache /tmp/transformers_cache /tmp/matplotlib_cache \
|
24 |
+
&& chmod -R 777 /app/output /tmp/huggingface_cache /tmp/transformers_cache /tmp/matplotlib_cache
|
25 |
+
|
26 |
+
# Copy the requirements.txt into the container
|
27 |
+
COPY requirements.txt /tmp/
|
28 |
+
|
29 |
+
# Install Python dependencies
|
30 |
+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
31 |
+
|
32 |
+
# Copy source code into the container
|
33 |
+
COPY . /app
|
34 |
+
|
35 |
+
# Set the working directory to the application directory
|
36 |
+
WORKDIR /app
|
37 |
+
|
38 |
+
# Optional: Set environment variables for better TensorFlow logging
|
39 |
+
ENV TF_CPP_MIN_LOG_LEVEL=2
|
40 |
+
|
41 |
+
# Command to run training and keep the app alive
|
42 |
+
CMD ["python", "quickstart.py"]
|