Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[URGENT] WebAPI container has not built due to segmentation fault #498

Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/2-pre-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
permissions:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/4-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
permissions:
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
Expand Down
26 changes: 18 additions & 8 deletions src/CarbonAware.WebApi/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
# For OpenAPI document
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS openapi-env
WORKDIR /app
ENV DOTNET_ROLL_FORWARD LatestMajor
COPY . ./
RUN dotnet build CarbonAware.WebApi/src/CarbonAware.WebApi.csproj -o build
WORKDIR /app/CarbonAware.WebApi/src
RUN dotnet tool restore && \
dotnet tool run swagger tofile --output /app/build/swagger.yaml --yaml /app/build/CarbonAware.WebApi.dll v1


# Builder
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG TARGETARCH
WORKDIR /app
ENV DOTNET_ROLL_FORWARD LatestMajor
# Copy everything from source
COPY . ./
# Use implicit restore to build and publish
RUN dotnet publish CarbonAware.WebApi/src/CarbonAware.WebApi.csproj -c Release -o publish
# Generate OpenAPI spec
WORKDIR /app/CarbonAware.WebApi/src
RUN dotnet tool restore && \
mkdir -p /app/publish/wwwroot/api/v1 && \
dotnet tool run swagger tofile --output /app/publish/wwwroot/api/v1/swagger.yaml --yaml /app/publish/CarbonAware.WebApi.dll v1
RUN dotnet publish CarbonAware.WebApi/src/CarbonAware.WebApi.csproj -a $TARGETARCH -o publish


# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
# Install curl for health check
RUN apt-get update && \
apt-get install -y --no-install-recommends curl
# Copy artifacts from build-env
# Copy artifacts
WORKDIR /app
COPY --from=build-env /app/publish .
RUN mkdir -p /app/wwwroot/api/v1
COPY --from=openapi-env /app/build/swagger.yaml /app/wwwroot/api/v1/
ENTRYPOINT ["dotnet", "CarbonAware.WebApi.dll"]
3 changes: 2 additions & 1 deletion src/GSF.CarbonAware/src/GSF.CarbonAware.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
<PackageReference Include="WireMock.Net" Version="1.5.6" />
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -57,4 +58,4 @@
<ItemGroup Label="IncludeSymbols" Condition="$(IncludeSymbols) == true">
<Content Include="$(TargetDir)/CarbonAware*.pdb" Pack="true" PackagePath="lib/net8.0/" />
</ItemGroup>
</Project>
</Project>
Loading