Skip to content

Commit

Permalink
Add more documentation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb authored Aug 26, 2024
1 parent 77fd7cb commit 3c9736c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Exclude the project virtual environment from image builds
.venv
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ See the [uv Docker integration guide](https://docs.astral.sh/uv/guides/integrati

## Running the image

A `run.sh` convenience is provided for quickly building the image and starting a container.
A [`run.sh`](./run.sh) utility is provided for quickly building the image and starting a container.

This script demonstrates best practices for developing using the container, using bind mounts for
the project and virtual environment directories.

To run the application in an image:

Expand Down
12 changes: 11 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#!/usr/bin/env sh
#
# Build and run the example Docker image.
#
# Mounts the local project directory to reflect a common development workflow.

docker run --rm --volume .:/app --volume /app/.venv -it $(docker build -q .) $@

docker run \
--rm \ # Remove the container after exiting
--volume .:/app \ # Mount the current directory to `/app` so code changes don't require an image rebuild
--volume /app/.venv \ # Mount the virtual environment separately, so the developer's environment doesn't end up in the container
-it $(docker build -q .) \ # Build the image, then use it as a run target
$@ # Pass any arguments to the container

0 comments on commit 3c9736c

Please sign in to comment.