Skip to content

Commit 71f2f12

Browse files
committed
update dockerfile for uv
1 parent 70037cf commit 71f2f12

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Dockerfile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ FROM python:3.10-slim
22

33
# git is needed for getting the repo commit
44
RUN apt-get update && apt-get install -y git libmagic1
5-
RUN pip install pipenv
5+
6+
COPY --from=ghcr.io/astral-sh/uv:0.4.9 /uv /bin/uv
7+
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
8+
9+
ENV UV_PROJECT_ENVIRONMENT=/app/venv
610

711

812
# Set the working directory in the container
@@ -14,19 +18,20 @@ WORKDIR /app
1418
# needed because we changed users
1519
RUN git config --global --add safe.directory /app
1620

17-
# ADD Pipfile.lock Pipfile .
18-
COPY Pipfile.lock Pipfile.lock
19-
COPY Pipfile Pipfile
21+
COPY pyproject.toml pyproject.toml
22+
COPY uv.lock uv.lock
23+
RUN uv sync --locked --no-install-project --no-dev --no-cache
2024

21-
# Copy requirements file and install dependencies
22-
RUN pipenv install --system --deploy
25+
# remove uv binary copied in earlier to hopefully save some space
26+
USER root
27+
RUN rm /bin/uv
28+
USER campuspulse
2329

2430
# Copy the app's source code to the container
2531
COPY . .
2632

2733
# Expose the port the Flask app runs on
2834
EXPOSE 5000
2935

30-
3136
# Run the Flask application
32-
CMD python3 -m gunicorn --workers 1 --bind 0.0.0.0:5000 app:app
37+
CMD gunicorn --workers 1 --bind 0.0.0.0:5000 app:app

0 commit comments

Comments
 (0)