-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (39 loc) · 1.22 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
46
47
48
49
50
51
52
53
54
55
56
57
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
# Setting the environment variables
USER $APP_UID
# Setting the working directory
WORKDIR /app
# Exposing the ports
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# Setting the build configuration
ARG BUILD_CONFIGURATION=Release
# Setting the working directory
WORKDIR /src
# Copying csproj files
COPY ["webapi/webapi.csproj", "webapi/"]
COPY ["domain/domain.csproj", "domain/"]
COPY ["data/data.csproj", "data/"]
COPY ["settings/settings.csproj", "settings/"]
COPY ["tests/tests.csproj", "tests/"]
# Restoring dependencies
RUN dotnet restore "webapi/webapi.csproj"
# Copying the rest of the files
COPY . .
# Accessing the webapi directory
WORKDIR "/src/webapi"
# Building the project
RUN dotnet build "webapi.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
# Setting the build configuration
ARG BUILD_CONFIGURATION=Release
# Publishing the project
RUN dotnet publish "webapi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
# Setting the working directory
WORKDIR /app
# Copying the published files
COPY --from=publish /app/publish .
# Running the application
ENTRYPOINT ["dotnet", "smo-api.dll"]