Spaces:
Build error
Build error
Update Dockerfile
Browse files- DOCKERFILE +16 -10
DOCKERFILE
CHANGED
@@ -6,29 +6,35 @@ RUN useradd -m -u 1000 user
|
|
6 |
|
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 |
|
15 |
# Install poetry
|
16 |
RUN pip install poetry
|
17 |
|
18 |
-
|
19 |
-
POETRY_VIRTUALENVS_IN_PROJECT=1 \
|
20 |
-
POETRY_VIRTUALENVS_CREATE=1 \
|
21 |
-
POETRY_CACHE_DIR=/tmp/poetry_cache
|
22 |
-
|
23 |
COPY --chown=user ./backend/pyproject.toml ./backend/poetry.lock $HOME/app/
|
24 |
-
COPY --chown=user ./backend $HOME/app
|
25 |
|
|
|
26 |
RUN poetry install --without dev && \
|
|
|
27 |
rm -rf /tmp/poetry_cache
|
28 |
|
|
|
29 |
COPY --chown=user ./backend $HOME/app
|
30 |
|
|
|
|
|
|
|
31 |
# Change to the package directory
|
32 |
-
WORKDIR $HOME/
|
33 |
|
34 |
-
CMD ["
|
|
|
6 |
|
7 |
USER user
|
8 |
|
9 |
+
# Set home to the user's home directory and Poetry's environment variables
|
10 |
ENV HOME=/home/user \
|
11 |
+
PATH=/home/user/.local/bin:$PATH \
|
12 |
+
POETRY_NO_INTERACTION=1 \
|
13 |
+
POETRY_VIRTUALENVS_IN_PROJECT=1 \
|
14 |
+
POETRY_VIRTUALENVS_CREATE=1 \
|
15 |
+
POETRY_CACHE_DIR=/tmp/poetry_cache
|
16 |
|
17 |
+
# Set the working directory to /app
|
18 |
WORKDIR $HOME/app
|
19 |
|
20 |
# Install poetry
|
21 |
RUN pip install poetry
|
22 |
|
23 |
+
# Copy the poetry files
|
|
|
|
|
|
|
|
|
24 |
COPY --chown=user ./backend/pyproject.toml ./backend/poetry.lock $HOME/app/
|
|
|
25 |
|
26 |
+
# Install the dependencies
|
27 |
RUN poetry install --without dev && \
|
28 |
+
--no-root && \
|
29 |
rm -rf /tmp/poetry_cache
|
30 |
|
31 |
+
# Copy the rest of the files
|
32 |
COPY --chown=user ./backend $HOME/app
|
33 |
|
34 |
+
# Install the package
|
35 |
+
RUN poetry install --without dev
|
36 |
+
|
37 |
# Change to the package directory
|
38 |
+
WORKDIR $HOME/app/backend
|
39 |
|
40 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]
|