Skip to content

Create api-dev docker target #1007

@ahouseholder

Description

@ahouseholder

When you run docker-compose up api it constructs a static image that copies the source code into the image. Later, when the code changes, you can add the --build option to force it to reconstruct a new image with the newer code, but that remains a static snapshot of the code at build time. This is what you want for prod environments, but not super helpful in dev.

Locally (outside of docker) you can run uv --project=src run uvicorn ssvc.api.main:app --reload --port=7777 to get a "live" (reload on changes to code) server. Which is good enough for many scenarios.

However, we'd like to support easy bootstrapping for new SSVC developers, so we need a containerized version of the "live" server.

The task for this issue is to add a separate api-dev target that mounts the code from the host and runs the --reload command above.

We already have a similar thing in the works over on Vultron.

What we've learned so far is that it takes a bit of wrangling to avoid corruption of the uv-managed .venv between the container and the host OS. You want them to remain separate, so mounting the whole project directory doesn't work. The solution is essentially to just avoid having the host .venv be part of the mounted volume inside the container.

Tip

It might be better to wait until #980 is resolved before tackling this because the location of the .venv will likely change once that merge occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttech/backendBack-end tools, code, infrastructuretech/environmentProject environment, deployment, CI, etc.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions