Spaces:
Paused
Paused
Andrew Smith
commited on
Commit
·
6cf9bee
1
Parent(s):
36da43d
change the home directory
Browse files- Dockerfile +13 -4
Dockerfile
CHANGED
@@ -1,8 +1,18 @@
|
|
1 |
FROM python:3.10
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Get secret DB_URL and output it to /test at buildtime
|
8 |
RUN --mount=type=secret,id=DB_URL,mode=0444,required=true \
|
@@ -10,7 +20,6 @@ RUN --mount=type=secret,id=DB_URL,mode=0444,required=true \
|
|
10 |
|
11 |
RUN pip install --no-cache-dir poetry
|
12 |
|
13 |
-
RUN poetry
|
14 |
-
&& poetry install --no-dev
|
15 |
|
16 |
CMD ["poetry", "run", "start"]
|
|
|
1 |
FROM python:3.10
|
2 |
|
3 |
+
# Set up a new user named "user" with user ID 1000
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
# Switch to the "user" user
|
6 |
+
USER user
|
7 |
+
# Set home to the user's home directory
|
8 |
+
ENV HOME=/home/user \
|
9 |
+
PATH=/home/user/.local/bin:$PATH
|
10 |
|
11 |
+
# Set the working directory to the user's home directory
|
12 |
+
WORKDIR $HOME/app
|
13 |
+
|
14 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
15 |
+
COPY --chown=user . $HOME/app
|
16 |
|
17 |
# Get secret DB_URL and output it to /test at buildtime
|
18 |
RUN --mount=type=secret,id=DB_URL,mode=0444,required=true \
|
|
|
20 |
|
21 |
RUN pip install --no-cache-dir poetry
|
22 |
|
23 |
+
RUN poetry install --only main
|
|
|
24 |
|
25 |
CMD ["poetry", "run", "start"]
|