PharmaVault ships a multi-stage Dockerfile that produces a minimal production image. Each stage has a specific responsibility: the full .NET 10 SDK compiles and publishes the application, and a lightweight ASP.NET runtime image then carries only the output binaries — no SDK, no source code, no build tooling.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JReyna217/PharmaVault/llms.txt
Use this file to discover all available pages before exploring further.
Multi-Stage Build
The three stages follow a deliberate progression that keeps the final image as small as possible while using Docker’s layer cache to speed up repeated builds.Build Stage — mcr.microsoft.com/dotnet/sdk:10.0
The first stage uses the full .NET 10 SDK image. It copies each project’s
.csproj file individually before copying the rest of the source. This ordering lets Docker cache the dotnet restore layer: dependency restoration is only re-run when a project file actually changes.Publish Stage — optimise the binaries
The publish stage inherits from the build stage and runs
dotnet publish to produce a self-contained, trimmed output directory. The /p:UseAppHost=false flag suppresses generating a native executable wrapper — the container’s entrypoint calls dotnet directly, so the wrapper is unnecessary..NET 8 and later (including .NET 10) configure ASP.NET Core to listen on port 8080 inside Docker containers by default. No
ASPNETCORE_URLS override is needed.Full Dockerfile
Building the Image
Run the following command from the root of the repository. The tagpharmavault-app:latest is the name referenced in the docker run command in the next section.
Running the Container
Thedocker run command below is the recommended way to start PharmaVault in production. Each flag is explained in the table that follows.
| Flag | Purpose |
|---|---|
-d | Run the container in detached (background) mode so the terminal is not attached to the container’s output. |
--name pharmavault-web | Assigns a human-readable name to the container, used by all subsequent management commands. |
--restart unless-stopped | Automatically restart the container after a crash or server reboot — unless it was explicitly stopped with docker stop. |
-p 5010:8080 | Maps host port 5010 to container port 8080. Nginx will proxy external HTTPS traffic to 127.0.0.1:5010. |
--add-host=host.docker.internal:host-gateway | Injects a DNS entry that resolves host.docker.internal to the host machine’s gateway IP. This allows the containerised app to reach a PostgreSQL instance installed natively on the host. |
-e "ConnectionStrings__DefaultConnection=..." | Passes the database connection string as an environment variable. The double underscore (__) is the .NET convention for mapping environment variables to nested configuration keys — ConnectionStrings__DefaultConnection maps to ConnectionStrings:DefaultConnection in appsettings.json. |