Spaces:
Build error
Build error
Commit
·
c13745d
1
Parent(s):
08e5dcd
remove user
Browse files- Dockerfile +15 -21
Dockerfile
CHANGED
@@ -12,33 +12,27 @@ ENV PATH="/root/.local/bin:$PATH"
|
|
12 |
# Create a symlink so Poetry is accessible system-wide
|
13 |
RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
# Copy Poetry files first to optimize Docker caching
|
19 |
-
COPY pyproject.toml poetry.lock /code/
|
20 |
|
21 |
-
|
22 |
-
RUN poetry install --no-root --no-interaction --no-ansi
|
23 |
|
24 |
-
#
|
25 |
-
|
26 |
|
27 |
-
#
|
28 |
-
|
29 |
|
30 |
-
#
|
31 |
-
RUN
|
32 |
-
&& chown -R 1000:1000 /code
|
33 |
|
34 |
-
|
35 |
-
# USER 1000
|
36 |
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
ENV PYTHONUNBUFFERED=1
|
42 |
|
43 |
-
|
44 |
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
12 |
# Create a symlink so Poetry is accessible system-wide
|
13 |
RUN ln -s /root/.local/bin/poetry /usr/local/bin/poetry
|
14 |
|
15 |
+
## (Optional) If you want to keep 'USER' for final container usage,
|
16 |
+
# just do all installations as root FIRST, then switch user at the end.
|
17 |
+
# But for a simpler approach in Docker, you can remain root entirely.
|
|
|
|
|
18 |
|
19 |
+
FROM python:3.10
|
|
|
20 |
|
21 |
+
# Install Poetry
|
22 |
+
RUN curl -sSL https://install.python-poetry.org | python3 -
|
23 |
|
24 |
+
# Set Poetry in PATH
|
25 |
+
ENV PATH="/root/.local/bin:$PATH"
|
26 |
|
27 |
+
# Make sure script is executable (usually it already is, but just to be safe):
|
28 |
+
RUN chmod +x /root/.local/bin/poetry
|
|
|
29 |
|
30 |
+
WORKDIR /code
|
|
|
31 |
|
32 |
+
COPY pyproject.toml poetry.lock /code/
|
33 |
+
RUN poetry install --no-root --no-interaction --no-ansi
|
34 |
|
35 |
+
COPY . /code
|
|
|
36 |
|
37 |
+
EXPOSE 7860
|
38 |
CMD ["poetry", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|