This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
144 lines (113 loc) · 4.48 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Base image containing dependencies used in builder and final image
FROM ghcr.io/swissgrc/azure-pipelines-openjdk:17.0.12.0 AS base
# Builder image
FROM base AS build
# Make sure to fail due to an error at any stage in shell pipes
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# renovate: datasource=repology depName=debian_12/curl versioning=loose
ENV CURL_VERSION=7.88.1-10+deb12u8
RUN apt-get update -y && \
# Install necessary dependencies
apt-get install -y --no-install-recommends curl=${CURL_VERSION} && \
# Add Git LFS PPA
curl --proto "=https" -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh \
| bash && \
# Add NodeJS PPA
curl --proto "=https" -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
NODE_MAJOR=20 && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
| tee /etc/apt/sources.list.d/nodesource.list
# Add .NET PPA
ADD https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb /tmp/packages-microsoft-prod.deb
RUN dpkg -i /tmp/packages-microsoft-prod.deb && \
rm -rf /tmp/*
# Final image
FROM base AS final
LABEL org.opencontainers.image.vendor="Swiss GRC AG"
LABEL org.opencontainers.image.authors="Swiss GRC AG <[email protected]>"
LABEL org.opencontainers.image.title="azure-pipelines-sonarscannermsbuild"
LABEL org.opencontainers.image.documentation="https://github.com/swissgrc/docker-azure-pipelines-sonarscannermsbuild"
# Make sure to fail due to an error at any stage in shell pipes
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /
# Copy Git LFS & NodeJS PPA keyring
COPY --from=build /etc/apt/keyrings/ /etc/apt/keyrings
# Copy .NET keyring
COPY --from=build /usr/share/keyrings/ /usr/share/keyrings
COPY --from=build /etc/apt/trusted.gpg.d/ /etc/apt/trusted.gpg.d
# Copy sources
COPY --from=build /etc/apt/sources.list.d/ /etc/apt/sources.list.d
# Install Git
# renovate: datasource=repology depName=debian_12/git versioning=loose
ENV GIT_VERSION=1:2.39.5-0+deb12u1
RUN apt-get update -y && \
# Install Git
apt-get install -y --no-install-recommends git=${GIT_VERSION} && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Smoke test
git version
# Install Git LFS
# renovate: datasource=github-tags depName=git-lfs/git-lfs extractVersion=^v(?<version>.*)$
ENV GITLFS_VERSION=3.5.1
RUN apt-get update -y && \
# Install Git LFS
apt-get install -y --no-install-recommends git-lfs=${GITLFS_VERSION} && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Smoke test
git lfs version
# Install NodeJS
# renovate: datasource=github-tags depName=nodejs/node extractVersion=^v(?<version>.*)$
ENV NODE_VERSION=20.18.0
# Install NodeJS
RUN apt-get update -y && \
# Install NodeJs
apt-get install -y --no-install-recommends nodejs=${NODE_VERSION}-1nodesource1 && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Smoke test
node -v
# Install .NET
# renovate: datasource=github-tags depName=dotnet/sdk extractVersion=^v(?<version>.*)$
ENV DOTNET_VERSION=6.0.428
ENV \
# Do not show first run text
DOTNET_NOLOGO=true \
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true \
# Disable telemetry
DOTNET_CLI_TELEMETRY_OPTOUT=true \
# Enable correct mode for dotnet watch (only mode supported in a container)
DOTNET_USE_POLLING_FILE_WATCHER=true \
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
NUGET_XMLDOC_MODE=skip
RUN apt-get update -y && \
# Install .NET
apt-get install -y --no-install-recommends dotnet-sdk-6.0=${DOTNET_VERSION}-1 && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Smoke test
dotnet --info
# Install Dependencies required for dotnet test coverage
# renovate: datasource=repology depName=debian_12/libxml2 versioning=loose
ENV LIBXML_VERSION=2.9.14+dfsg-1.3~deb12u1
RUN apt-get update -y && \
apt-get install -y --no-install-recommends libxml2=${LIBXML_VERSION} && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install tools required by Sonar extension for Azure DevOps
# renovate: datasource=repology depName=debian_12/unzip versioning=deb
ENV UNZIP_VERSION=6.0
RUN apt-get update -y && \
# Install unzip
apt-get install -y --no-install-recommends unzip=${UNZIP_VERSION}-28 && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
# Smoke test
unzip --hh