mwitiderrick commited on
Commit
f6fa8c1
·
verified ·
1 Parent(s): f14ac03

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -7
Dockerfile CHANGED
@@ -1,16 +1,29 @@
1
  FROM python:3.11
 
 
2
  RUN useradd -m -u 1000 user
3
  USER user
4
- ENV PATH="/home/user/.local/bin:$PATH"
5
 
6
- ENV VIRTUAL_ENV=/home/user/venv
 
 
 
 
 
7
  RUN python -m venv $VIRTUAL_ENV
8
- ENV PATH="$VIRTUAL_ENV/bin:$PATH"
9
 
 
10
  WORKDIR /app
11
- COPY --chown=user ./requirements.txt requirements.txt
12
 
13
- RUN pip install -r requirements.txt
 
 
 
 
 
 
 
 
14
 
15
- COPY --chown=user . /app
16
- CMD python3 -m chainlit run app.py --host 0.0.0.0 --port 7860
 
1
  FROM python:3.11
2
+
3
+ # Create a non-root user
4
  RUN useradd -m -u 1000 user
5
  USER user
 
6
 
7
+ # Set environment variables
8
+ ENV HOME=/home/user \
9
+ VIRTUAL_ENV=/home/user/venv \
10
+ PATH="/home/user/.local/bin:/home/user/venv/bin:$PATH"
11
+
12
+ # Create virtual environment
13
  RUN python -m venv $VIRTUAL_ENV
 
14
 
15
+ # Set working directory
16
  WORKDIR /app
 
17
 
18
+ # Copy and install dependencies
19
+ COPY --chown=user requirements.txt .
20
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
21
+
22
+ # Copy source code
23
+ COPY --chown=user . .
24
+
25
+ # Expose port (optional but good practice)
26
+ EXPOSE 7860
27
 
28
+ # Launch app
29
+ CMD ["python", "-m", "chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]