-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (35 loc) · 1.06 KB
/
Dockerfile
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
# build env
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app
# copy all the necessary backend app files to the container
COPY ./Controllers ./Controllers
COPY ./Hubs ./Hubs
COPY ./Models ./Models
COPY ./Modules ./Modules
COPY ./Properties ./Properties
COPY ./Services ./Services
COPY ./appsettings.Development.json ./
COPY ./appsettings.json ./
COPY ./DawnLitWeb.csproj ./
COPY ./Program.cs ./
# Update Dotnet ef tool
RUN dotnet tool update --global dotnet-ef
# setup env
ENV PATH="$PATH:/root/.dotnet/tools"
# migrate the models
RUN dotnet ef migrations add TheMigration
# Sync the models with the database:
RUN dotnet ef database update
# Restore as distinct layers
RUN dotnet restore
# Build and publish a release
RUN dotnet publish -c Release -o out
# RUN dotnet tool install --global dotnet-ef
# ENV PATH="$PATH:/root/.dotnet/tools"
# RUN dotnet ef migrations add TheMigration
# RUN dotnet ef database update
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "DawnLitWeb.dll"]