riu-rd commited on
Commit
a4340fa
·
verified ·
1 Parent(s): 82becce

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -7
Dockerfile CHANGED
@@ -2,23 +2,34 @@ FROM python:3.11.8
2
 
3
  WORKDIR /
4
 
 
5
  COPY requirements.txt ./
6
 
7
- RUN pip install --no-cache-dir -r /requirements.txt
 
8
 
9
- # Add user with appropriate permissions
10
  RUN useradd -m -u 1000 user
11
 
12
- # Create app directory and grant access
13
- RUN mkdir -p /home/user/app && chmod -R 777 /home/user
14
-
15
  USER user
16
-
17
  ENV HOME=/home/user \
18
- PATH=/home/user/.local/bin:$PATH
19
 
 
20
  WORKDIR $HOME/app
21
 
 
22
  COPY --chown=user . $HOME/app/
23
 
 
 
 
 
 
 
 
 
 
 
24
  CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /
4
 
5
+ # Copy requirements.txt to the container
6
  COPY requirements.txt ./
7
 
8
+ # Install Python dependencies
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
 
11
+ # Add a non-root user to run the application
12
  RUN useradd -m -u 1000 user
13
 
14
+ # Set the user and home directory environment variables
 
 
15
  USER user
 
16
  ENV HOME=/home/user \
17
+ PATH=/home/user/.local/bin:$PATH
18
 
19
+ # Create the application directory
20
  WORKDIR $HOME/app
21
 
22
+ # Copy the application code and model files
23
  COPY --chown=user . $HOME/app/
24
 
25
+ # Ensure the directory for the SavedModel exists
26
+ RUN mkdir -p prod_models/emo_model_tf
27
+
28
+ # Specify the correct path to the SavedModel
29
+ ENV SAVED_MODEL_PATH=$HOME/app/prod_models/emo_model_tf
30
+
31
+ # Expose the port the FastAPI app runs on
32
+ EXPOSE 7860
33
+
34
+ # Command to run the FastAPI app
35
  CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]