rahul-appu commited on
Commit
2a13ba4
·
1 Parent(s): 23b2b76

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -4
Dockerfile CHANGED
@@ -1,16 +1,27 @@
1
  FROM python:3.10.9
2
 
 
3
  RUN useradd -m -u 1000 user
 
 
4
  USER user
 
 
5
  ENV HOME=/home/user \
6
- PATH=/home/user/.local/bin:$PATH
 
7
 
8
- COPY --chown=user . $HOME/Redaction
 
9
 
 
10
  WORKDIR $HOME/Redaction
11
 
12
- RUN mkdir $HOME/.cache
 
13
 
 
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
 
16
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10.9
2
 
3
+ # Create user with home directory
4
  RUN useradd -m -u 1000 user
5
+
6
+ # Switch to the created user
7
  USER user
8
+
9
+ # Set environment variables
10
  ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH \
12
+ TRANSFORMERS_CACHE=/home/user/.cache
13
 
14
+ # Create necessary directories with the right permissions
15
+ RUN mkdir -p $HOME/.cache && chmod -R 777 $HOME/.cache
16
 
17
+ # Set the working directory
18
  WORKDIR $HOME/Redaction
19
 
20
+ # Copy project files to the working directory
21
+ COPY --chown=user . $HOME/Redaction
22
 
23
+ # Install dependencies
24
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
25
 
26
+ # Set the command to run the application
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]