forked from FromDoppler/doppler-html-editor-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (42 loc) · 1.91 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
44
45
46
47
48
# cSpell: enableCompoundWords
FROM node:20 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.9.0 as verify-sh
WORKDIR /src
COPY ./*.sh ./
RUN shellcheck -e SC1091,SC1090 ./*.sh
FROM mcr.microsoft.com/dotnet/sdk:7.0.203-bullseye-slim AS restore
WORKDIR /src
COPY ./*.sln ./
# Using `Doppler.` prefix to avoid docker confuse symlink with directories
# "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.5-bullseye-slim AS final
# We need these changes in openssl.cnf to access to our SQL Server instances in QA and INT environments
# See more information in https://stackoverflow.com/questions/56473656/cant-connect-to-sql-server-named-instance-from-asp-net-core-running-in-docker/59391426#59391426
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf \
&& sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf \
&& sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf \
&& sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf
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"