Update Dockerfile
Browse files- Dockerfile +10 -9
Dockerfile
CHANGED
@@ -10,27 +10,28 @@ RUN apt-get update && \
|
|
10 |
fonts-liberation \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
# Create cache directory with
|
14 |
RUN mkdir -p /app/.cache && \
|
15 |
-
|
16 |
|
17 |
WORKDIR /app
|
18 |
|
19 |
-
# Set environment variables
|
20 |
-
ENV
|
21 |
-
HF_DATASETS_CACHE=/app/.cache \
|
22 |
XDG_CACHE_HOME=/app/.cache
|
23 |
|
24 |
-
# Install
|
25 |
COPY requirements.txt .
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
28 |
-
#
|
29 |
RUN python -c "from transformers import GPT2LMHeadModel; \
|
30 |
-
GPT2LMHeadModel.from_pretrained('gpt2-medium', use_safetensors=True)"
|
|
|
31 |
|
32 |
COPY . .
|
33 |
|
34 |
-
# Run as non-root user
|
35 |
USER 1000
|
|
|
36 |
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "600", "app:app"]
|
|
|
10 |
fonts-liberation \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Create cache directory with full permissions
|
14 |
RUN mkdir -p /app/.cache && \
|
15 |
+
chmod -R 777 /app/.cache
|
16 |
|
17 |
WORKDIR /app
|
18 |
|
19 |
+
# Set updated Hugging Face environment variables
|
20 |
+
ENV HF_HOME=/app/.cache \
|
|
|
21 |
XDG_CACHE_HOME=/app/.cache
|
22 |
|
23 |
+
# Install requirements
|
24 |
COPY requirements.txt .
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
|
27 |
+
# Pre-download model
|
28 |
RUN python -c "from transformers import GPT2LMHeadModel; \
|
29 |
+
GPT2LMHeadModel.from_pretrained('gpt2-medium', use_safetensors=True)" && \
|
30 |
+
chmod -R 777 /app/.cache
|
31 |
|
32 |
COPY . .
|
33 |
|
34 |
+
# Run as non-root user with explicit permissions
|
35 |
USER 1000
|
36 |
+
RUN chmod -R 777 /app/.cache
|
37 |
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--timeout", "600", "app:app"]
|