-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (22 loc) · 953 Bytes
/
Dockerfile
File metadata and controls
26 lines (22 loc) · 953 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
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build
ARG TARGETARCH
WORKDIR /source
# Copy project file and restore as distinct layers
COPY --link ./global.json ./
COPY --link ./Directory.Packages.props ./
COPY --link ./RedisStarterCSharp.Api/RedisStarterCSharp.Api.csproj ./RedisStarterCSharp.Api/
RUN dotnet restore ./RedisStarterCSharp.Api/RedisStarterCSharp.Api.csproj -a $TARGETARCH
# Copy source code and publish app
COPY --link . .
RUN dotnet publish ./RedisStarterCSharp.Api -a $TARGETARCH -o /app
# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine
EXPOSE 8080
WORKDIR /app
COPY --link --from=build /app .
USER $APP_UID
ENTRYPOINT ["./RedisStarterCSharp.Api"]