gitlost-murali commited on
Commit
27b79c7
1 Parent(s): 896e60d

update Dockerfile to limit user access

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -11
Dockerfile CHANGED
@@ -1,22 +1,27 @@
1
- # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
  FROM ubuntu:22.04
5
- # install curl
6
- RUN apt-get update && apt-get install -y curl && apt-get install -y git && \
 
7
  curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
8
  apt-get install -y git-lfs
9
 
10
- WORKDIR /code
11
-
12
- RUN git lfs clone https://huggingface.co/AskUI/pta-text-0.1 /code/model/
13
-
14
  COPY ./requirements.txt /code/requirements.txt
 
15
 
16
- RUN apt-get install -y python3 python3-pip
 
 
 
 
17
 
18
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
19
 
 
 
 
 
20
  COPY . .
21
 
22
  CMD ["python3", "app.py"]
 
 
 
 
1
  FROM ubuntu:22.04
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y curl git python3 python3-pip && \
5
  curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
6
  apt-get install -y git-lfs
7
 
8
+ # Install Python dependencies
 
 
 
9
  COPY ./requirements.txt /code/requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
 
12
+ # Create a user, set environment variables, and define work directory
13
+ RUN useradd -m -u 1000 user
14
+ USER user
15
+ ENV HOME=/home/user \
16
+ PATH=/home/user/.local/bin:$PATH
17
 
18
+ WORKDIR $HOME/app
19
+ COPY --chown=user . $HOME/app
20
 
21
+ # Continue with the rest of the setup
22
+ WORKDIR /code
23
+
24
+ RUN git lfs clone https://huggingface.co/AskUI/pta-text-0.1 /code/model/
25
  COPY . .
26
 
27
  CMD ["python3", "app.py"]