Spaces:
Running
Running
tomas-gajarsky
commited on
Commit
·
9c74fd7
1
Parent(s):
b5d23b1
Change user in Docker
Browse files- Dockerfile +12 -7
Dockerfile
CHANGED
@@ -1,20 +1,25 @@
|
|
1 |
FROM python:3.9.12-slim
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
RUN chown -R admin:admin $WORKDIR
|
8 |
RUN chmod 755 $WORKDIR
|
9 |
|
10 |
-
COPY requirements.txt $WORKDIR/requirements.txt
|
11 |
|
12 |
RUN pip install gradio --no-cache-dir
|
13 |
RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
|
14 |
|
15 |
-
COPY . .
|
16 |
-
|
17 |
-
USER admin
|
18 |
|
19 |
EXPOSE 7860
|
20 |
|
|
|
1 |
FROM python:3.9.12-slim
|
2 |
|
3 |
+
# Set up a new user named "user" with user ID 1000
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
|
6 |
+
# Switch to the "user" user
|
7 |
+
USER user
|
8 |
+
|
9 |
+
# Set home to the user's home directory
|
10 |
+
ENV HOME=/home/user \
|
11 |
+
PATH=/home/user/.local/bin:$PATH
|
12 |
+
|
13 |
+
WORKDIR $HOME/app
|
14 |
RUN chown -R admin:admin $WORKDIR
|
15 |
RUN chmod 755 $WORKDIR
|
16 |
|
17 |
+
COPY --chown=user requirements.txt $WORKDIR/requirements.txt
|
18 |
|
19 |
RUN pip install gradio --no-cache-dir
|
20 |
RUN pip install --no-cache-dir --upgrade -r $WORKDIR/requirements.txt
|
21 |
|
22 |
+
COPY --chown=user . .
|
|
|
|
|
23 |
|
24 |
EXPOSE 7860
|
25 |
|