-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (36 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
44 lines (36 loc) · 1.18 KB
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
41
42
43
44
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
ARG PROJECT
ARG ENTRY_PREFIX
RUN echo PROJECT=$PROJECT
RUN echo ENTRY_PREFIX=$ENTRY_PREFIX
WORKDIR /app
EXPOSE 80
# RUN apt update && \
# apt install -y curl && \
# curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && \
# chmod +x ./kubectl && \
# mv ./kubectl /usr/local/bin/kubectl
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG PROJECT
ARG ENTRY_PREFIX
WORKDIR /src
COPY ["./", "/src"]
RUN dotnet restore "$PROJECT/$PROJECT.csproj" --configfile "./nuget.config"
COPY . .
WORKDIR "/src/$PROJECT"
RUN dotnet build "$PROJECT.csproj" -c Release -o /app/build
FROM build AS publish
ARG PROJECT
ARG ENTRY_PREFIX
RUN dotnet publish "$PROJECT.csproj" -c Release -o /app/publish
FROM base AS final
ARG PROJECT
ARG ENTRY_PREFIX
WORKDIR /app
# RUN groupadd -r microuser && useradd -r -s /bin/false -g microuser microuser
COPY --from=publish /app/publish .
# RUN chown -R microuser:microuser /app
# USER microuser
ENV entry_point $ENTRY_PREFIX$PROJECT.dll
RUN echo $entry_point
ENTRYPOINT dotnet $entry_point