amirulhazym
commited on
Commit
·
2afbfcf
1
Parent(s):
11d582c
fix(deploy): Set correct directory ownership for model cache
Browse files- Dockerfile +7 -5
Dockerfile
CHANGED
@@ -4,8 +4,7 @@ FROM python:3.10-slim
|
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /code
|
6 |
|
7 |
-
#
|
8 |
-
# Install system-level dependencies required by our app, Git LFS, AND curl for our health check
|
9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
10 |
git \
|
11 |
git-lfs \
|
@@ -13,9 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
13 |
&& git lfs install \
|
14 |
&& rm -rf /var/lib/apt/lists/*
|
15 |
|
16 |
-
#
|
17 |
-
# This environment variable tells all Hugging Face libraries to save models
|
18 |
-
# inside our app's directory at /code/.cache, which we have permission to write to.
|
19 |
ENV HF_HOME=/code/.cache
|
20 |
|
21 |
# Copy the requirements file first to leverage Docker cache
|
@@ -28,6 +25,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
28 |
# Copy the rest of the application code into the container
|
29 |
COPY . .
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
# Make our startup script executable
|
32 |
RUN chmod +x ./setup.sh
|
33 |
|
|
|
4 |
# Set the working directory inside the container
|
5 |
WORKDIR /code
|
6 |
|
7 |
+
# Install system-level dependencies
|
|
|
8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
git \
|
10 |
git-lfs \
|
|
|
12 |
&& git lfs install \
|
13 |
&& rm -rf /var/lib/apt/lists/*
|
14 |
|
15 |
+
# Set a local cache directory inside our workspace
|
|
|
|
|
16 |
ENV HF_HOME=/code/.cache
|
17 |
|
18 |
# Copy the requirements file first to leverage Docker cache
|
|
|
25 |
# Copy the rest of the application code into the container
|
26 |
COPY . .
|
27 |
|
28 |
+
# --- THE DEFINITIVE FIX ---
|
29 |
+
# Change the owner of the /code directory to the user the app will run as.
|
30 |
+
# The user is 'user' which has ID 1000. This grants write permissions.
|
31 |
+
RUN chown -R 1000:1000 /code
|
32 |
+
|
33 |
# Make our startup script executable
|
34 |
RUN chmod +x ./setup.sh
|
35 |
|