Skip to content

Commit 75079b3

Browse files
authored
Clarify Dockerfile for non-package applications (#269)
1 parent 91fc786 commit 75079b3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ COPY pyproject.toml uv.lock ./
4646
# Install only project dependencies, as this is cached until pyproject.toml uv.lock are updated.
4747
RUN uv sync --locked --no-default-groups --no-install-project
4848

49-
# Copy in source files. README is required for the package to build.
49+
# Copy in source files.
50+
# README.md is required for the package to build. It can be ommited for non-package applications.
5051
COPY README.md ./
5152
COPY src src
5253

5354
# Install the rest of the application into the virtual environment.
55+
# Omit this step if your project is a non-package application and copy the source in the second
56+
# stage instead.
5457
RUN uv sync --locked --no-default-groups --no-editable
5558

5659
## Final Image
@@ -84,8 +87,8 @@ WORKDIR ${APP_HOME}
8487
COPY --from=python_builder ${UV_PROJECT_ENVIRONMENT} ${UV_PROJECT_ENVIRONMENT}
8588
ENV PATH="${UV_PROJECT_ENVIRONMENT}/bin:${PATH}"
8689

87-
# For Python applications that are not installable libraries, you may need to copy in source
88-
# files here in the final image rather than in the python_builder image.
90+
# For non-package applications, COPY source files here rather than in the --no-editable step
91+
# in the python_builder stage.
8992

9093
# Give access to the entire home folder to the new user so that files and folders can be written
9194
# there. Some packages such as matplotlib, want to write to the home folder.

0 commit comments

Comments
 (0)