Skip to content

Commit d5773b3

Browse files
committed
optimize docker file
1 parent 5a7d126 commit d5773b3

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

src/authorization/Dockerfile

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,68 @@
11
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
2-
WORKDIR /app
3-
EXPOSE 8080
42

3+
WORKDIR /app
54
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
65

6+
EXPOSE 8080
7+
78
FROM node:18.15.0-alpine AS angularBuild
9+
810
WORKDIR /angular
11+
912
COPY ["authorization/EventTriangle.Client/package.json", "EventTriangle.Client/"]
13+
1014
COPY ["authorization/EventTriangle.Client/package-lock.json", "EventTriangle.Client/"]
15+
1116
WORKDIR "EventTriangle.Client"
17+
1218
RUN npm ci
19+
1320
WORKDIR /angular
21+
1422
COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"]
15-
RUN npm install -g @angular/cli@15.2.7
23+
24+
#RUN npm install -g @angular/cli@15.2.7
25+
1626
WORKDIR "EventTriangle.Client"
27+
1728
ARG FRONT_API_URL
29+
1830
RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json
31+
1932
RUN ng build --output-path "dist/client"
2033

2134
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS publish
35+
2236
WORKDIR /src
37+
2338
COPY ["authorization/EventTriangleAPI.Authorization.BusinessLogic/EventTriangleAPI.Authorization.BusinessLogic.csproj", "authorization/EventTriangleAPI.Authorization.BusinessLogic/"]
2439
COPY ["authorization/EventTriangleAPI.Authorization.Domain/EventTriangleAPI.Authorization.Domain.csproj", "authorization/EventTriangleAPI.Authorization.Domain/"]
2540
COPY ["authorization/EventTriangleAPI.Authorization.Persistence/EventTriangleAPI.Authorization.Persistence.csproj", "authorization/EventTriangleAPI.Authorization.Persistence/"]
2641
COPY ["authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj", "authorization/EventTriangleAPI.Authorization.Presentation/"]
27-
COPY ["authorization/EventTriangleAPI.Authorization.UnitTests/EventTriangleAPI.Authorization.UnitTests.csproj", "authorization/EventTriangleAPI.Authorization.UnitTests/"]
2842
COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"]
2943
COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"]
44+
3045
RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj"
46+
3147
COPY . .
48+
3249
WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation"
50+
3351
ARG VERSION
34-
RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache
52+
53+
RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" \
54+
-c Release \
55+
-p:Version=$VERSION \
56+
-o /app/publish \
57+
/p:UseAppHost=false \
58+
/p:PublishTrimmed=true \
59+
/p:TieredCompilation=false
3560

3661
FROM base AS final
3762
WORKDIR /app
63+
3864
COPY --from=publish /app/publish .
65+
3966
COPY --from=angularBuild "/angular/EventTriangle.Client/dist/client" wwwroot
67+
4068
ENTRYPOINT ["dotnet", "EventTriangleAPI.Authorization.Presentation.dll"]

src/authorization/EventTriangle.Client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"devDependencies": {
3131
"@angular-devkit/build-angular": "^15.2.5",
32-
"@angular/cli": "~15.2.5",
32+
"@angular/cli": "~15.2.7",
3333
"@angular/compiler-cli": "^15.2.0",
3434
"@types/jasmine": "~4.3.0",
3535
"jasmine-core": "~4.5.0",

0 commit comments

Comments
 (0)