Skip to content

Commit 7db8089

Browse files
authored
ci: install docker in bionic images (microsoft#39)
1 parent 77eecc2 commit 7db8089

File tree

3 files changed

+58
-14
lines changed

3 files changed

+58
-14
lines changed

bionic-arm64/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ FROM ${REPO}:${TAG}
44

55
ARG DEBIAN_FRONTEND=noninteractive
66

7+
RUN groupadd --gid 1000 builduser \
8+
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
9+
710
# ubuntu keeps its i386/amd64 and other architecture repos separate
811
# the default i386/amd64 packages can be found in http://archive.ubuntu.com while all other architectures are in http://ports.ubuntu.com/
912
# add the required repos for armhf/arm64 and only fetch i386/amd64 from archive.ubuntu.com (to prevent apt from erroring about missing architecture support)
@@ -33,6 +36,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3336
gnupg \
3437
unzip
3538

39+
# No Sudo Prompt
40+
RUN echo 'builduser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-builduser \
41+
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
42+
3643
# Set python3 as default
3744
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
3845
RUN python --version
@@ -42,6 +49,21 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
4249
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
4350
RUN apt-get update && apt-get install -y yarn
4451

52+
# Node.js
53+
RUN curl --silent --location https://deb.nodesource.com/setup_16.x | sudo -E bash -
54+
RUN apt-get update && apt-get install -y nodejs
55+
RUN npm install -g npm@latest
56+
RUN npm install -g node-gyp
57+
58+
# Install docker client
59+
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
60+
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
61+
RUN echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
62+
RUN sudo apt-get update && sudo apt-get install -y docker-ce
63+
64+
USER builduser
65+
WORKDIR /home/builduser
66+
4567
ENV AS=/usr/bin/aarch64-linux-gnu-as \
4668
AR=/usr/bin/aarch64-linux-gnu-ar \
4769
CC=/usr/bin/aarch64-linux-gnu-gcc-8 \

bionic-armhf/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ FROM ${REPO}:${TAG}
44

55
ARG DEBIAN_FRONTEND=noninteractive
66

7+
RUN groupadd --gid 1000 builduser \
8+
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser
9+
710
# ubuntu keeps its i386/amd64 and other architecture repos separate
811
# the default i386/amd64 packages can be found in http://archive.ubuntu.com while all other architectures are in http://ports.ubuntu.com/
912
# add the required repos for armhf/arm64 and only fetch i386/amd64 from archive.ubuntu.com (to prevent apt from erroring about missing architecture support)
@@ -33,6 +36,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3336
gnupg \
3437
unzip
3538

39+
# No Sudo Prompt
40+
RUN echo 'builduser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-builduser \
41+
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
42+
3643
# Set python3 as default
3744
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
3845
RUN python --version
@@ -42,6 +49,21 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
4249
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
4350
RUN apt-get update && apt-get install -y yarn
4451

52+
# Node.js
53+
RUN curl --silent --location https://deb.nodesource.com/setup_16.x | sudo -E bash -
54+
RUN apt-get update && apt-get install -y nodejs
55+
RUN npm install -g npm@latest
56+
RUN npm install -g node-gyp
57+
58+
# Install docker client
59+
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
60+
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
61+
RUN echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
62+
RUN sudo apt-get update && sudo apt-get install -y docker-ce
63+
64+
USER builduser
65+
WORKDIR /home/builduser
66+
4567
ENV AS=/usr/bin/arm-linux-gnueabihf-as \
4668
AR=/usr/bin/arm-linux-gnueabihf-ar \
4769
CC=/usr/bin/arm-linux-gnueabihf-gcc-8 \

bionic-x64/Dockerfile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,30 @@ RUN apt-get update && apt-get install -y \
5454
&& bash /setup/install-build-deps.sh --no-syms --no-prompt --no-chromeos-fonts --no-arm --no-nacl \
5555
&& rm -rf /var/lib/apt/lists/*
5656

57+
# No Sudo Prompt
58+
RUN echo 'builduser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-builduser \
59+
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
60+
5761
# Yarn
5862
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
5963
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
6064
RUN apt-get update && apt-get install -y yarn
6165

62-
# No Sudo Prompt
63-
RUN echo 'builduser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-builduser \
64-
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
65-
66-
# Dotnet
67-
RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
68-
RUN dpkg -i packages-microsoft-prod.deb
69-
RUN apt-get update && apt-get install -y dotnet-sdk-2.1
66+
# Node.js
67+
RUN curl --silent --location https://deb.nodesource.com/setup_16.x | sudo -E bash -
68+
RUN apt-get update && apt-get install -y nodejs
69+
RUN npm install -g npm@latest
70+
RUN npm install -g node-gyp
7071

7172
# Set python3 as default
7273
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
7374
RUN python --version
7475

75-
# Add xvfb init script
76-
COPY xvfb-init.sh /etc/init.d/xvfb
77-
RUN chmod a+x /etc/init.d/xvfb
78-
79-
# Setup dbus path
80-
RUN sudo mkdir -p /var/run/dbus
76+
# Install docker client
77+
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
78+
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
79+
RUN echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
80+
RUN sudo apt-get update && sudo apt-get install -y docker-ce
8181

8282
# Check compiler toolchain
8383
RUN gcc --version

0 commit comments

Comments
 (0)