-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-api
29 lines (26 loc) · 1.39 KB
/
Dockerfile-api
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
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
RUN apk add icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
WORKDIR /app
EXPOSE 8080
ENV ASPNETCORE_URLS=http://*:8080
# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
WORKDIR /src
COPY ["book-a-reading-room-visit.api/book-a-reading-room-visit.api.csproj", "book-a-reading-room-visit.api/"]
COPY ["book-a-reading-room-visit.data/book-a-reading-room-visit.data.csproj", "book-a-reading-room-visit.data/"]
COPY ["book-a-reading-room-visit.domain/book-a-reading-room-visit.domain.csproj", "book-a-reading-room-visit.domain/"]
RUN dotnet restore "book-a-reading-room-visit.api/book-a-reading-room-visit.api.csproj"
COPY . .
WORKDIR "/src/book-a-reading-room-visit.api"
RUN dotnet build "book-a-reading-room-visit.api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "book-a-reading-room-visit.api.csproj" -c Release -o /app/publish /p:UseAppHost=false
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
RUN addgroup -g 965 -S appuser && adduser -u 975 -S -D -h /app appuser appuser
USER appuser
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "book-a-reading-room-visit.api.dll"]