-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
34 lines (26 loc) · 1.12 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
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /build
# Copy csproj and restore as distinct layers
COPY sama/sama.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY sama/ ./
RUN dotnet publish -c Release -o out --no-restore /p:MvcRazorCompileOnPublish=true
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /opt/sama
COPY --from=build-env /build/out .
ENTRYPOINT ["dotnet", "sama.dll"]
ENV ASPNETCORE_ENVIRONMENT=Docker
# ------ CONFIGURATION:
# Mount this volume for DB persistence:
VOLUME /opt/sama-docker
# Set this to "true" when launching container if running behind reverse proxy:
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=false
# Change this to bind to a specific interface or different port, if needed:
ENV ASPNETCORE_URLS="http://*:80"
# HTTPS example -- these variables can be specified on the CLI or via docker-compose:
#ENV ASPNETCORE_URLS="https://*:443"
#ENV ASPNETCORE_Kestrel__Certificates__Default__Path=/opt/sama-docker/ssl.pem
#ENV ASPNETCORE_Kestrel__Certificates__Default__KeyPath=/opt/sama-docker/ssl.key
#ENV ASPNETCORE_Kestrel__EndpointDefaults__Protocols=Http1AndHttp2