gitlost-murali commited on
Commit
364b7d1
1 Parent(s): 93209fd
Files changed (1) hide show
  1. Dockerfile +26 -14
Dockerfile CHANGED
@@ -1,26 +1,38 @@
1
- # Install system dependencies
2
- RUN apt-get update && apt-get install -y curl git python3 python3-pip && \
 
 
 
 
3
  curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
4
  apt-get install -y git-lfs
5
 
6
- # Create the code directory and ensure it's owned by the non-root user
7
- RUN mkdir -p /code && chown user:user /code
 
 
8
 
9
- # Switch to non-root user
10
- RUN useradd -m -u 1000 user
11
  USER user
12
  ENV HOME=/home/user \
13
  PATH=/home/user/.local/bin:$PATH \
14
- MPLCONFIGDIR=$HOME/.config/matplotlib \
15
- TRANSFORMERS_CACHE=$HOME/.cache/huggingface/hub
 
 
 
 
 
 
16
 
17
- WORKDIR /code
 
 
18
 
19
- # Clone the repository using git clone and set up Git LFS
20
  RUN git lfs install && \
21
- git clone https://huggingface.co/AskUI/pta-text-0.1 ./model
22
 
23
- # Copy the rest of your application files
24
- COPY --chown=user . .
25
 
26
- CMD ["python3", "app.py"]
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM ubuntu:22.04
3
+
4
+ # Install system dependencies required for Python and Git LFS
5
+ RUN apt-get update && \
6
+ apt-get install -y curl git python3 python3-pip && \
7
  curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
8
  apt-get install -y git-lfs
9
 
10
+ # Set up a user to avoid running as root
11
+ RUN useradd -m -u 1000 user && \
12
+ mkdir -p /home/user/app /home/user/.cache/huggingface/hub /home/user/.config/matplotlib && \
13
+ chown -R user:user /home/user
14
 
15
+ # Set environment variables
 
16
  USER user
17
  ENV HOME=/home/user \
18
  PATH=/home/user/.local/bin:$PATH \
19
+ MPLCONFIGDIR=/home/user/.config/matplotlib \
20
+ TRANSFORMERS_CACHE=/home/user/.cache/huggingface/hub
21
+
22
+ # Set the working directory in the container
23
+ WORKDIR $HOME/app
24
+
25
+ # Copy the current directory contents into the container at $HOME/app
26
+ COPY --chown=user:user . .
27
 
28
+ # Install Python dependencies
29
+ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
30
+ pip install --no-cache-dir -r requirements.txt
31
 
32
+ # Clone the necessary Git repository
33
  RUN git lfs install && \
34
+ git clone https://huggingface.co/AskUI/pta-text-0.1 $HOME/app/model
35
 
 
 
36
 
37
+ # Run app.py when the container launches
38
+ CMD ["python3", "app.py"]