-
Notifications
You must be signed in to change notification settings - Fork 61
/
Dockerfile
139 lines (123 loc) · 6.39 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
# Default arguments
ARG containerdIoLinuxComponentVersion='1.4.12-1'
ARG dockerComposeLinuxComponentVersion='1.28.5'
ARG dockerLinuxComponentVersion='5:20.10.12~3-0~ubuntu'
ARG dotnetLibs='libc6 libgcc1 libgssapi-krb5-2 libicu66 libssl1.1 libstdc++6 zlib1g'
ARG dotnetLinuxComponent='https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.413/dotnet-sdk-6.0.413-linux-x64.tar.gz'
ARG dotnetLinuxComponent_31='https://dotnetcli.azureedge.net/dotnet/Runtime/3.1.32/dotnet-runtime-3.1.32-linux-x64.tar.gz'
ARG dotnetLinuxComponent_50='https://dotnetcli.azureedge.net/dotnet/Runtime/5.0.17/dotnet-runtime-5.0.17-linux-x64.tar.gz'
ARG dotnetLinuxComponentSHA512='4390ba65e592c4f770b247f11228bbd2ed70aab30fbe6613c2bf7ec0c7c54d09b5a47ff160d4424dacc59661613fd4c9460d62f141a64def02a7228dd160f916'
ARG dotnetLinuxComponentSHA512_31='56c5e045844f5474a9a12b42e4a22c851985fac5690e227ce62b529d644c4faeaafdfe255de2f1e86a90c0c114e7de66ce4de1692fbf66357ac4d35341f933c3'
ARG dotnetLinuxComponentSHA512_50='f47eec03d2b6777e78e2a993306727fa6871cf7f6e295ed70f684745a9f9fc960f0068750007519733426db52afa10e0bcd1c58879019d5d8f1f5f295868e4f3'
ARG gitLFSLinuxComponentVersion='2.9.2-1'
ARG gitLinuxComponentVersion='1:2.42.0-0ppa1~ubuntu20.04.1'
ARG p4Version='2022.2-2468771'
ARG repo='https://hub.docker.com/r/jetbrains/'
ARG teamcityMinimalAgentImage='teamcity-minimal-agent:EAP-linux'
# The list of required arguments
# ARG dotnetLinuxComponent
# ARG dotnetLinuxComponentSHA512
# ARG dotnetLinuxComponent_31
# ARG dotnetLinuxComponentSHA512_31
# ARG dotnetLinuxComponent_50
# ARG dotnetLinuxComponentSHA512_50
# ARG teamcityMinimalAgentImage
# ARG dotnetLibs
# ARG gitLinuxComponentVersion
# ARG gitLFSLinuxComponentVersion
# ARG dockerComposeLinuxComponentVersion
# ARG dockerLinuxComponentVersion
FROM ${teamcityMinimalAgentImage}
USER root
COPY run-docker.sh /services/run-docker.sh
ARG dotnetCoreLinuxComponentVersion
# Opt out of the telemetry feature
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true \
# Disable first time experience
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true \
# Configure Kestrel web server to bind to port 80 when present
ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=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 perfomance
NUGET_XMLDOC_MODE=skip \
GIT_SSH_VARIANT=ssh \
DOTNET_SDK_VERSION=${dotnetCoreLinuxComponentVersion}
ARG dotnetLinuxComponent
ARG dotnetLinuxComponentSHA512
ARG dotnetLinuxComponent_31
ARG dotnetLinuxComponentSHA512_31
ARG dotnetLinuxComponent_50
ARG dotnetLinuxComponentSHA512_50
ARG dotnetLibs
ARG gitLinuxComponentVersion
ARG gitLFSLinuxComponentVersion
ARG dockerComposeLinuxComponentVersion
ARG dockerLinuxComponentVersion
ARG containerdIoLinuxComponentVersion
ARG p4Version
RUN apt-get update && \
apt-get install -y mercurial apt-transport-https software-properties-common && \
add-apt-repository ppa:git-core/ppa -y && \
apt-get install -y git=${gitLinuxComponentVersion} git-lfs=${gitLFSLinuxComponentVersion} && \
git lfs install --system && \
# https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#dkl-di-0005
apt-get clean && rm -rf /var/lib/apt/lists/* && \
# Perforce (p4 CLI)
apt-key adv --fetch-keys https://package.perforce.com/perforce.pubkey && \
(. /etc/os-release && \
echo "deb http://package.perforce.com/apt/$ID $VERSION_CODENAME release" > \
/etc/apt/sources.list.d/perforce.list ) && \
apt-get update && \
(. /etc/os-release && apt-get install -y helix-cli-base="${p4Version}~$VERSION_CODENAME" helix-cli="${p4Version}~$VERSION_CODENAME" ) && \
# https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#dkl-di-0005
apt-get clean && rm -rf /var/lib/apt/lists/* && \
# Docker & ContainerD
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
apt-cache policy docker-ce && \
apt-get update && \
apt-get install -y docker-ce=${dockerLinuxComponentVersion}-$(lsb_release -cs) \
docker-ce-cli=${dockerLinuxComponentVersion}-$(lsb_release -cs) \
containerd.io:amd64=${containerdIoLinuxComponentVersion} \
systemd && \
systemctl disable docker && \
sed -i -e 's/\r$//' /services/run-docker.sh && \
# Docker Compose
curl -SL "https://github.com/docker/compose/releases/download/${dockerComposeLinuxComponentVersion}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose && \
# Dotnet
apt-get install -y --no-install-recommends ${dotnetLibs} && \
# https://github.com/goodwithtech/dockle/blob/master/CHECKPOINT.md#dkl-di-0005
apt-get clean && rm -rf /var/lib/apt/lists/* && \
mkdir -p /usr/share/dotnet && \
# .NET Framework 3.1
curl -SL ${dotnetLinuxComponent_31} --output /tmp/dotnet.tar.gz && \
echo "${dotnetLinuxComponentSHA512_31} */tmp/dotnet.tar.gz" | sha512sum -c -; \
tar -zxf /tmp/dotnet.tar.gz -C /usr/share/dotnet && \
rm /tmp/dotnet.tar.gz && \
find /usr/share/dotnet -name "*.lzma" -type f -delete && \
# .NET 5.0
curl -SL ${dotnetLinuxComponent_50} --output /tmp/dotnet.tar.gz && \
echo "${dotnetLinuxComponentSHA512_50} */tmp/dotnet.tar.gz" | sha512sum -c -; \
tar -zxf /tmp/dotnet.tar.gz -C /usr/share/dotnet && \
rm /tmp/dotnet.tar.gz && \
find /usr/share/dotnet -name "*.lzma" -type f -delete && \
# .NET 6.0
curl -SL ${dotnetLinuxComponent} --output /tmp/dotnet.tar.gz && \
echo "${dotnetLinuxComponentSHA512} */tmp/dotnet.tar.gz" | sha512sum -c -; \
tar -zxf /tmp/dotnet.tar.gz -C /usr/share/dotnet && \
rm /tmp/dotnet.tar.gz && \
find /usr/share/dotnet -name "*.lzma" -type f -delete && \
ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet && \
# Trigger .NET CLI first run experience by running arbitrary cmd to populate local package cache
dotnet help && \
dotnet --info && \
# Other
apt-get clean && rm -rf /var/lib/apt/lists/* && \
chown -R buildagent:buildagent /services && \
usermod -aG docker buildagent
# A better fix for TW-52939 Dockerfile build fails because of aufs
VOLUME /var/lib/docker
USER buildagent