alaa-ahmed14 commited on
Commit
9bdbe34
·
verified ·
1 Parent(s): 31cc367

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -10
Dockerfile CHANGED
@@ -7,21 +7,33 @@ RUN apt-get update && apt-get install -y git git-lfs
7
  # Initialize git-lfs
8
  RUN git-lfs install
9
 
10
- # Set the working directory
11
- WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  # Clone the Hugging Face model repository (replace with the desired model URL)
14
- RUN git clone https://huggingface.co/matsant01/STEMerald-2b /app/model
15
 
16
- # Install necessary Python libraries
17
- COPY requirements.txt .
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- # Copy the application code
21
- COPY . .
22
 
23
- # Expose the app port (if using FastAPI or another web server)
24
  EXPOSE 8000
25
-
26
- # Command to run the FastAPI server
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
7
  # Initialize git-lfs
8
  RUN git-lfs install
9
 
10
+ # Create a non-root user and set up environment variables
11
+ RUN useradd -m -u 9000 user
12
+
13
+ # Set environment variables
14
+ ENV HOME=/home/user \
15
+ TRANSFORMERS_CACHE=/home/user/.cache \
16
+ PATH=/home/user/.local/bin:$PATH
17
+
18
+ # Switch to the newly created user
19
+ USER user
20
+
21
+ # Set the working directory inside the container
22
+ WORKDIR $HOME/app
23
+
24
+ # Copy the requirements file
25
+ COPY --chown=user:user requirements.txt .
26
 
27
  # Clone the Hugging Face model repository (replace with the desired model URL)
28
+ RUN git clone https://huggingface.co/matsant01/STEMerald-2b $HOME/app/model
29
 
30
+ # Install dependencies
 
31
  RUN pip install --no-cache-dir -r requirements.txt
32
 
33
+ # Copy the application code and set file ownership
34
+ COPY --chown=user:user . .
35
 
36
+ # Expose the port and run the app with Uvicorn
37
  EXPOSE 8000
 
 
38
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
39
+