-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
41 lines (26 loc) · 1005 Bytes
/
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
# Use the official .NET SDK image with version 6.0 as the base image
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
# Set the working directory in the container
WORKDIR /var/www/poisncopy
# Copy only the necessary files for restoring dependencies
COPY *.csproj .
RUN dotnet restore
# Copy the entire project and build it
COPY . .
RUN dotnet build --configuration Release
# Publish the application
RUN dotnet publish -c Release -o out
# Use the official .NET runtime image with version 6.0 as the base image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
# Set the working directory in the container
WORKDIR /var/www/poisncopy
# Copy the published application to the container
COPY --from=build /var/www/poisncopy/out .
# Start the application
ENTRYPOINT ["/usr/bin/dotnet", "/var/www/poisncopy/PoisnCopy.dll"]
# How to build and run the Docker image
# 1. Build the Docker image
# docker build -t poisncopy:latest .
# 2. Run the Docker image
# docker run poisncopy:latest
# 3. Enjoy !!!