-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile
109 lines (109 loc) · 5.45 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
FROM ubuntu:20.04
HEALTHCHECK --interval=1m --timeout=2s CMD ps aux | grep --color=never [A]gent.Listener
RUN mkdir /agent
WORKDIR /agent
# basics:
RUN apt-get update && \
apt-get install -y software-properties-common apt-transport-https && \
apt-get upgrade -y && \
apt-add-repository ppa:git-core/ppa && \
apt-get update
# azure pipelines dependencies
# from: https://github.com/microsoft/azure-pipelines-agent/blob/25aa1872da9199dd3c7dc1721864887718ab27b4/src/Misc/layoutbin/installdependencies.sh#L107
RUN apt-get install -y libssl1.1 || apt-get install -y libssl1.0.2 || apt-get install -y libssl1.0.0 && \
apt-get install -y libicu67 || apt-get install -y libicu66 || apt-get install -y libicu63 || apt-get install -y libicu60 || apt-get install -y libicu57 || apt-get install -y libicu55 || apt-get install -y libicu52
# other dependencies:
RUN apt-get install -y iproute2 libuuid1 libunwind8 gdebi-core build-essential libssl-dev
# tools
RUN apt-get install -y git wget curl zip unzip vim sudo iputils-ping python2 python3 python3-pip jq
# pip2
RUN wget -q https://bootstrap.pypa.io/pip/2.7/get-pip.py -O get-pip.py && \
python2 get-pip.py && \
rm get-pip.py && \
ln -s /usr/bin/python3 /usr/bin/python
#users
RUN adduser --disabled-password --gecos '' agentuser && \
adduser agentuser sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Microsoft keys:
RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb
# dotnet
RUN apt-get update && apt-get install -y dotnet-sdk-3.1 dotnet-sdk-6.0
ENV PATH="${PATH}:/home/agentuser/.dotnet/tools"
# az cli:
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | \
tee /etc/apt/sources.list.d/azure-cli.list && \
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
apt-get update && \
apt-get install -y azure-cli
# pwsh:
RUN apt-get install -y powershell
# nvm/node/yarn:
RUN curl -fSsL https://deb.nodesource.com/setup_18.x | bash
RUN apt-get install -y nodejs
USER agentuser
RUN curl -fSso- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm i 12 && nvm i 14 && nvm i 16" ]
RUN [ "/bin/bash", "-c", "source $HOME/.nvm/nvm.sh && nvm alias default 16" ]
USER root
RUN curl -fsS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get -y --no-install-recommends install yarn
# chrome:
RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
gdebi --non-interactive google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb
# kubectl:
RUN curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg && \
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list && \
apt-get update && \
apt-get install -y kubectl
# helm 2:
RUN curl -fSsL https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash && \
mv /usr/local/bin/helm /usr/local/bin/helm2
# helm 3:
RUN curl -fSsL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
# terraform:
RUN wget -q https://releases.hashicorp.com/terraform/1.2.6/terraform_1.2.6_linux_amd64.zip -O terraform.zip && \
unzip -d /usr/local/bin/ terraform.zip && \
rm terraform.zip
# openjdk and maven
RUN apt-get install -y openjdk-17-jdk gradle
ENV JAVA_HOME_17_X64=/usr/lib/jvm/java-17-openjdk-amd64/
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
RUN curl -fSsL https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -o maven.tgz && \
tar -xzvf maven.tgz && \
mv apache-maven-3.8.6 /opt/ && \
ln -s /opt/apache-maven-3.8.6/bin/mvn /usr/bin/mvn && \
ln -s /opt/apache-maven-3.8.6/bin/mvnDebug /usr/bin/mvnDebug
# mssql-cli
# uncomment when fixed (install on Ubuntu 20.04): https://github.com/dbcli/mssql-cli/issues/482
# RUN apt-get install -y mssql-cli
RUN pip3 install mssql-cli
# sqlcmd
RUN ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev locales && \
locale-gen en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8
ENV PATH="${PATH}:/opt/mssql-tools/bin/"
# docker cli
RUN curl -fSsL https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz -o docker.tgz && \
tar xzvf docker.tgz --strip 1 -C /usr/local/bin docker/docker && \
rm docker.tgz
RUN curl -fSsL https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose
# cleanup
RUN apt-get autoremove -y
# agent:
RUN curl -fSsL https://vstsagentpackage.azureedge.net/agent/2.210.1/vsts-agent-linux-x64-2.210.1.tar.gz -o /agent/vsts-agent.tar.gz && \
tar xzf /agent/vsts-agent.tar.gz && \
rm /agent/vsts-agent.tar.gz
COPY configureAgent.sh runAgent.sh configureAndRun.sh /agent/
RUN chmod +x configureAndRun.sh configureAgent.sh runAgent.sh && \
chown agentuser:agentuser configureAgent.sh runAgent.sh configureAndRun.sh
RUN chown -R agentuser:agentuser /agent
USER agentuser
STOPSIGNAL SIGINT
COPY .vimrc /home/agentuser
CMD [ "/agent/configureAndRun.sh" ]