summaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: 941203602347db9cce7ca40265302c9a67ff90b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
EXPOSE 5001
# Copy csproj and restore as distinct layers
COPY src/PIT.ReservationService/PIT.ReservationService.csproj ./
COPY src/PIT.ReservationService/nuget.config ./
RUN dotnet restore

# Copy everything else and build
COPY src/PIT.ReservationService ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "PIT.ReservationService.dll", "--environment=Production"]
RUN apt-get update \
    && apt-get install -y apt-transport-https \
    && apt-get upgrade -y \
    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /var/cache/apt/archives