| FROM node:20-bookworm-slim AS web-build |
|
|
| WORKDIR /src/Accident.Web |
|
|
| COPY Accident.Web/package*.json ./ |
| RUN npm ci |
|
|
| COPY Accident.Web/ ./ |
| RUN npm run build -- --configuration production |
|
|
|
|
| FROM mcr.microsoft.com/dotnet/sdk:8.0 AS api-build |
|
|
| WORKDIR /src |
|
|
| COPY Accident.Api/LeGrange_API/LeGrange_API.csproj Accident.Api/LeGrange_API/ |
| RUN dotnet restore "Accident.Api/LeGrange_API/LeGrange_API.csproj" |
|
|
| COPY Accident.Api/ Accident.Api/ |
|
|
| COPY --from=web-build \ |
| /src/Accident.Web/dist/accident.web/browser \ |
| Accident.Api/LeGrange_API/wwwroot |
|
|
| RUN dotnet publish \ |
| "Accident.Api/LeGrange_API/LeGrange_API.csproj" \ |
| -c Release \ |
| -o /app/publish \ |
| /p:UseAppHost=false |
|
|
|
|
| FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final |
|
|
| WORKDIR /app |
|
|
| RUN apt-get update \ |
| && apt-get install -y --no-install-recommends \ |
| ca-certificates \ |
| openssl \ |
| tini \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| COPY --from=api-build /app/publish . |
|
|
| COPY storage/maps /app/storage/maps |
|
|
| ENV ASPNETCORE_URLS=http://+:8080 \ |
| ASPNETCORE_ENVIRONMENT=Production \ |
| DISABLE_HTTPS_REDIRECTION=true \ |
| RUN_MIGRATIONS_ON_STARTUP=true \ |
| OFFLINE_MAP_ROOT=/app/storage/maps \ |
| OSM_SEED_GEOJSON_PATH=/app/storage/maps/city-of-cape-town-osm.geojson |
|
|
| EXPOSE 8080 |
|
|
| ENTRYPOINT ["/usr/bin/tini", "--", "dotnet", "LeGrange_API.dll"] |