-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdockerfile
More file actions
37 lines (27 loc) · 1.28 KB
/
Copy pathdockerfile
File metadata and controls
37 lines (27 loc) · 1.28 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
# Use the official .NET 8 SDK image as a build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# Set the working directory
WORKDIR /app
# Copy the project file and restore dependencies
COPY . ./
RUN dotnet restore APSoilWithoutTests.sln
# Copy the rest of the application code
# Build the application
RUN dotnet publish APSoilWithoutTests.sln -c Release -o out
# Use the official .NET 8 runtime image as a runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# Set the working directory
WORKDIR /app
# Copy the build output from the build stage
COPY --from=build /app/out .
# Need Microsoft fonts for graph generation
RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list
RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig
# Expose the port the application runs on
EXPOSE 80
# Set the entry point for the application
ENTRYPOINT ["dotnet", "API.dll"]