-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
43 lines (37 loc) · 1.34 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
40
41
42
43
# cSpell: enableCompoundWords
FROM node:22 AS verify-format
WORKDIR /src
COPY package.json yarn.lock ./
RUN yarn
COPY . .
RUN yarn verify-format && yarn verify-spell
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.410-bullseye-slim AS restore
WORKDIR /src
COPY ./*.sln ./
# Using `Doppler.` prefix to avoid docker confuse symlink with directories
# cSpell: disable-next-line
# "ERROR: error from sender: readdir: readdirent Jenkinsfile: not a directory"
COPY Doppler.*/*.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.HtmlEditorApi/Doppler.HtmlEditorApi.csproj" -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:7.0.20-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.HtmlEditorApi.dll"]
LABEL name="doppler-html-editor-api" version="$version"