Skip to content

Commit 7bc64e2

Browse files
committed
Simplify pipenv or uv install in docker
1 parent f07b210 commit 7bc64e2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

backend/Dockerfile

+9-8
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ COPY --from=ghcr.io/astral-sh/uv@sha256:2381d6aa60c326b71fd40023f921a0a3b8f91b14
99
# Copy project dependencies
1010
COPY Pipfile* pyproject.toml uv.lock /app/
1111

12-
# Install project dependencies using pipenv if pipenv enabled
13-
RUN if [ "$DEPENDENCY_MANAGER" = "pipenv" ]; then pipenv install --system; fi
12+
# Install dependencies using uv or pipenv depending on DEPENDENCY_MANAGER arg
13+
RUN if [ "$DEPENDENCY_MANAGER" = "uv" ]; then \
14+
uv sync --frozen --no-dev --no-install-project --python $(which python); \
15+
mv /app/.venv/bin/uwsgi /usr/local/bin/uwsgi; \
16+
mv /app/.venv/bin/gunicorn /usr/local/bin/gunicorn; \
17+
else \
18+
pipenv install --system; \
19+
fi
1420

15-
# Install project dependencies if using uv if uv enabled
16-
RUN if [ "$DEPENDENCY_MANAGER" = "uv" ]; then uv sync --frozen --no-dev --no-install-project --python $(which python); fi
1721
# Make installed binaries available for POSIX compliant scripts
1822
ENV PATH="/app/.venv/bin:$PATH"
19-
# Patch for scripts that use a hard-coded path to uwsgi (django-run)
20-
RUN if [ "$DEPENDENCY_MANAGER" = "uv" ]; then mv /app/.venv/bin/uwsgi /usr/local/bin/uwsgi; fi
21-
# Patch for scripts that use a hard-coded path to gunicorn (asgi-run)
22-
RUN if [ "$DEPENDENCY_MANAGER" = "uv" ]; then mv /app/.venv/bin/gunicorn /usr/local/bin/gunicorn; fi
23+
2324
# Patch for scripts that use a hard-coded path to python (django-run, asgi-run)
2425
ENV PYTHONPATH="/app/.venv/lib/python3.11/site-packages/:$PYTHONPATH"
2526

0 commit comments

Comments
 (0)