-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (57 loc) · 1.98 KB
/
Dockerfile
File metadata and controls
76 lines (57 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Environment
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
# Working directory in container
WORKDIR /
# Container user
USER app
# Container ports
EXPOSE 8080
EXPOSE 8081
# Software development kit
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-server
# Copy project files
COPY ./Core.Database/Core.Database.csproj /src/Core.Database/
COPY ./Core.DAL/Core.DAL.csproj /src/Core.DAL/
COPY ./Core.BLL/Core.BLL.csproj /src/Core.BLL/
COPY ./Core.WebApi/Core.WebApi.csproj /src/Core.WebApi/
COPY ./Core.Server/Core.Server.csproj /src/Core.Server/
# Restore dependencies
RUN dotnet restore /src/Core.Server/Core.Server.csproj
# Copy everything from Dockerfile directory to container directory and build the server
COPY ./ /src
# Publish .net app to out folder
RUN dotnet publish /src/Core.Server/Core.Server.csproj --configuration Release --output /src/Core.Server/out
# Clients
#20.12.2-alpine3.19
FROM node:20-alpine AS build-client
# Install webpack, angularcli and rollup
RUN npm install webpack-cli -g && \
npm install webpack -g && \
npm install @angular/cli -g
#Vue client
COPY ./Core.Vue.UI /uisrc/Core.Vue.UI
WORKDIR /uisrc/Core.Vue.UI
RUN rm -rf node_modules package-lock.json && \
npm install && \
npm install --save-dev @rollup/rollup-linux-x64-musl && \
npm run build:prod
#Angular client
COPY ./Core.Angular.UI /uisrc/Core.Angular.UI
WORKDIR /uisrc/Core.Angular.UI
RUN rm -rf node_modules package-lock.json && \
npm install && \
npm run build:prod
#React client
COPY ./Core.React.UI /uisrc/Core.React.UI
WORKDIR /uisrc/Core.React.UI
RUN rm -rf node_modules package-lock.json && \
npm install && \
npm run build:prod
# Image
FROM base
COPY --from=build-server /src/Core.Server/out /
COPY --from=build-server /src/Core.Server/aspnetapp.pfx /aspnetapp.pfx
COPY --from=build-client /uisrc/Core.Angular.UI/out /client/angular
COPY --from=build-client /uisrc/Core.React.UI/out /client/react
COPY --from=build-client /uisrc/Core.Vue.UI/out /client/vue
ENTRYPOINT ["dotnet", "Core.Server.dll"]