Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docker/all-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ COPY src/GarageStack.Data/GarageStack.Data.csproj GarageStack.Data/
COPY src/GarageStack.Api/GarageStack.Api.csproj GarageStack.Api/
COPY src/GarageStack.Worker/GarageStack.Worker.csproj GarageStack.Worker/
# The NuGet cache lives in a BuildKit cache mount, so a local rebuild after a package change
# only downloads what changed. The packages are not in any layer, so publish mounts it too.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
# only downloads what changed. sharing=locked makes parallel builds take turns (compose builds
# the API and Worker at once): NuGet keeps its locks in each container's own /tmp, so two
# restores into one shared folder delete each other's files. publish restores again rather than
# rely on the restore layer, because BuildKit can keep that layer after it evicts the mount.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet restore GarageStack.Api/GarageStack.Api.csproj \
&& dotnet restore GarageStack.Worker/GarageStack.Worker.csproj
COPY src/GarageStack.Core/ GarageStack.Core/
COPY src/GarageStack.Data/ GarageStack.Data/
COPY src/GarageStack.Api/ GarageStack.Api/
COPY src/GarageStack.Worker/ GarageStack.Worker/
# ${APP_VERSION#v} strips a leading "v" (e.g. a tag name), which MinVer rejects
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish GarageStack.Api/GarageStack.Api.csproj --no-restore -c Release -o /publish/api /p:MinVerVersionOverride=${APP_VERSION#v} \
&& dotnet publish GarageStack.Worker/GarageStack.Worker.csproj --no-restore -c Release -o /publish/worker /p:MinVerVersionOverride=${APP_VERSION#v}
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet publish GarageStack.Api/GarageStack.Api.csproj -c Release -o /publish/api /p:MinVerVersionOverride=${APP_VERSION#v} \
&& dotnet publish GarageStack.Worker/GarageStack.Worker.csproj -c Release -o /publish/worker /p:MinVerVersionOverride=${APP_VERSION#v}

# ── Stage 3: Pull SAIC MQTT Gateway (source of truth for the gateway app) ────
# The gateway is not on PyPI. We copy its pre-built venv + source directly from
Expand Down
11 changes: 7 additions & 4 deletions src/GarageStack.Api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ COPY ["src/GarageStack.Core/GarageStack.Core.csproj", "GarageStack.Core/"]
COPY ["src/GarageStack.Data/GarageStack.Data.csproj", "GarageStack.Data/"]
COPY ["src/GarageStack.Api/GarageStack.Api.csproj", "GarageStack.Api/"]
# The NuGet cache lives in a BuildKit cache mount, so a local rebuild after a package change
# only downloads what changed. The packages are not in any layer, so publish mounts it too.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
# only downloads what changed. sharing=locked makes parallel builds take turns (compose builds
# the API and Worker at once): NuGet keeps its locks in each container's own /tmp, so two
# restores into one shared folder delete each other's files. publish restores again rather than
# rely on the restore layer, because BuildKit can keep that layer after it evicts the mount.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet restore "GarageStack.Api/GarageStack.Api.csproj"
COPY src/GarageStack.Core/ GarageStack.Core/
COPY src/GarageStack.Data/ GarageStack.Data/
COPY src/GarageStack.Api/ GarageStack.Api/
WORKDIR /src/GarageStack.Api
# ${APP_VERSION#v} strips a leading "v" (e.g. a tag name), which MinVer rejects
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish --no-restore -c Release -o /app /p:MinVerVersionOverride=${APP_VERSION#v}
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet publish -c Release -o /app /p:MinVerVersionOverride=${APP_VERSION#v}

# Alpine with the "extra" globalization set: full ICU data (the API answers in en, nl, es and
# pt) and tzdata (climate schedules keep their start time in an IANA zone) are built in. About
Expand Down
11 changes: 7 additions & 4 deletions src/GarageStack.Worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ COPY ["src/GarageStack.Core/GarageStack.Core.csproj", "GarageStack.Core/"]
COPY ["src/GarageStack.Data/GarageStack.Data.csproj", "GarageStack.Data/"]
COPY ["src/GarageStack.Worker/GarageStack.Worker.csproj", "GarageStack.Worker/"]
# The NuGet cache lives in a BuildKit cache mount, so a local rebuild after a package change
# only downloads what changed. The packages are not in any layer, so publish mounts it too.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
# only downloads what changed. sharing=locked makes parallel builds take turns (compose builds
# the API and Worker at once): NuGet keeps its locks in each container's own /tmp, so two
# restores into one shared folder delete each other's files. publish restores again rather than
# rely on the restore layer, because BuildKit can keep that layer after it evicts the mount.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet restore "GarageStack.Worker/GarageStack.Worker.csproj"
COPY src/GarageStack.Core/ GarageStack.Core/
COPY src/GarageStack.Data/ GarageStack.Data/
COPY src/GarageStack.Worker/ GarageStack.Worker/
WORKDIR /src/GarageStack.Worker
# ${APP_VERSION#v} strips a leading "v" (e.g. a tag name), which MinVer rejects
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish --no-restore -c Release -o /app /p:MinVerVersionOverride=${APP_VERSION#v}
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages,sharing=locked \
dotnet publish -c Release -o /app /p:MinVerVersionOverride=${APP_VERSION#v}

# Alpine with the "extra" globalization set: full ICU data (notifications are translated) and
# tzdata (climate schedules keep their start time in an IANA zone) are built in. About 37 MB
Expand Down
Loading