triflix commited on
Commit
b07fd41
·
verified ·
1 Parent(s): bb7b9c6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -8
Dockerfile CHANGED
@@ -1,25 +1,25 @@
1
  # Use official Python base image
2
  FROM python:3.9
3
 
4
- # Add a non-root user required by HF Spaces
5
  RUN useradd -m -u 1000 user
6
 
7
- # Set working directory
8
  WORKDIR /app
9
 
10
- # Copy requirements file and install dependencies
11
  COPY requirements.txt ./requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- # Copy your Jupyter notebooks or other files
15
  COPY . /app
16
 
17
- # Switch to the non-root user
18
  USER user
19
 
20
- # Set PATH and HOME environment variables correctly for the user
21
  ENV HOME=/home/user \
22
- PATH=/home/user/.local/bin:$PATH
 
23
 
24
- # Run JupyterLab server, accessible from outside with no token by default (token can be set with JUPYTER_TOKEN env var)
25
  CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=7860", "--no-browser", "--allow-root"]
 
1
  # Use official Python base image
2
  FROM python:3.9
3
 
4
+ # Add a non-root user (required by Hugging Face Spaces)
5
  RUN useradd -m -u 1000 user
6
 
 
7
  WORKDIR /app
8
 
9
+ # Copy requirements and install dependencies
10
  COPY requirements.txt ./requirements.txt
11
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
 
13
+ # Copy your notebooks and other files
14
  COPY . /app
15
 
16
+ # Switch to non-root user
17
  USER user
18
 
19
+ # Set environment variables including fixed JUPYTER_TOKEN
20
  ENV HOME=/home/user \
21
+ PATH=/home/user/.local/bin:$PATH \
22
+ JUPYTER_TOKEN=curseofwitcher
23
 
24
+ # Run JupyterLab on port 7860 with no browser and allow root
25
  CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=7860", "--no-browser", "--allow-root"]