-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
39 lines (33 loc) · 1.11 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
35
36
37
38
39
FROM node:22 AS verify-format
WORKDIR /src
COPY package.json yarn.lock ./
RUN yarn
COPY . .
RUN yarn verify-format
FROM koalaman/shellcheck-alpine:v0.10.0 as verify-sh
WORKDIR /src
COPY ./*.sh ./
RUN shellcheck -e SC1091,SC1090 ./*.sh
FROM mcr.microsoft.com/dotnet/sdk:7.0.305-bullseye-slim AS restore
WORKDIR /src
COPY ./*.sln ./
COPY */*.csproj ./
# Take into account using the same name for the folder and the .csproj and only one folder level
RUN for file in *.csproj; do mkdir -p -- "${file%.*}/" && mv -- "$file" "${file%.*}/"; done
RUN dotnet restore
FROM restore AS build
COPY . .
RUN dotnet format -v diagnostic --verify-no-changes \
&& dotnet build -c Release
FROM build AS test
RUN dotnet test
FROM build AS publish
RUN dotnet publish "./Doppler.HelloMicroservice/Doppler.HelloMicroservice.csproj" -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:7.0.8-bullseye-slim AS final
WORKDIR /app
EXPOSE 80
COPY --from=publish /app/publish .
ARG version=unknown
RUN echo $version > /app/wwwroot/version.txt
ENTRYPOINT ["dotnet", "Doppler.HelloMicroservice.dll"]
LABEL name="hello-microservice" version="$version"