-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 789 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 789 Bytes
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
# Use the official .NET SDK image for building
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy project files
COPY . ./
# Copy .env file if it exists
COPY .env* ./
# Restore dependencies
RUN dotnet restore
# Build the application
RUN dotnet publish -c Release -o out
# Use the runtime image for the final stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
# Copy the built application
COPY --from=build /app/out .
# Copy .env file to the final stage
COPY --from=build /app/.env* ./
# Create wwwroot directory
RUN mkdir -p wwwroot
# Expose port 5001
EXPOSE 5001
# Set environment variables
ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:5001
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# Run the application
ENTRYPOINT ["dotnet", "Agg.dll"]