Spaces:
Paused
Paused
Dobin Yim
commited on
Commit
·
2444848
1
Parent(s):
bf8793e
added user permission
Browse files- Dockerfile +22 -3
Dockerfile
CHANGED
@@ -1,13 +1,32 @@
|
|
1 |
FROM python:3.11
|
|
|
|
|
2 |
RUN useradd -m -u 1000 user
|
3 |
-
|
|
|
4 |
ENV HOME=/home/user \
|
5 |
PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
6 |
WORKDIR $HOME/app
|
|
|
|
|
7 |
COPY --chown=user . $HOME/app
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
COPY --chown=user requirements.txt requirements.txt
|
10 |
RUN pip install --no-cache-dir -r requirements.txt
|
11 |
RUN pip install --upgrade chainlit
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
CMD ["chainlit", "run", "final.py", "--port", "7860"]
|
|
|
1 |
FROM python:3.11
|
2 |
+
|
3 |
+
# Create a user and set the user ID
|
4 |
RUN useradd -m -u 1000 user
|
5 |
+
|
6 |
+
# Set environment variables
|
7 |
ENV HOME=/home/user \
|
8 |
PATH=/home/user/.local/bin:$PATH
|
9 |
+
|
10 |
+
# Set the working directory
|
11 |
WORKDIR $HOME/app
|
12 |
+
|
13 |
+
# Copy the application code and set ownership
|
14 |
COPY --chown=user . $HOME/app
|
15 |
+
|
16 |
+
# Ensure the upload and temp directories exist and have the correct permissions
|
17 |
+
RUN mkdir -p $HOME/app/uploads $HOME/app/temp && \
|
18 |
+
chown -R user:user $HOME/app/uploads $HOME/app/temp
|
19 |
+
|
20 |
+
# Switch to the user
|
21 |
+
USER user
|
22 |
+
|
23 |
+
# Install dependencies
|
24 |
COPY --chown=user requirements.txt requirements.txt
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
RUN pip install --upgrade chainlit
|
27 |
+
|
28 |
+
# Copy the rest of the application code
|
29 |
+
COPY --chown=user . .
|
30 |
+
|
31 |
+
# Set the command to run the application
|
32 |
CMD ["chainlit", "run", "final.py", "--port", "7860"]
|