-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile.template
150 lines (137 loc) · 5.16 KB
/
Dockerfile.template
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
145
146
147
148
149
150
# vim:set ft=dockerfile:
# Do not edit individual Dockerfiles manually. Instead, please make changes to the Dockerfile.template, which will be used by the build script to generate Dockerfiles.
FROM %%PARENT%%:%%VERSION_FULL%%
LABEL maintainer="CircleCI Execution Team <[email protected]>"
# Change default shell for RUN from Dash to Bash
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive \
TERM=dumb \
PAGER=cat
# Configure environment
RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci && \
echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci && \
apt-get update && apt-get install -y \
curl \
locales \
sudo \
&& \
locale-gen en_US.UTF-8 && \
rm -rf /var/lib/apt/lists/* && \
\
groupadd --gid=1002 circleci && \
useradd --uid=1001 --gid=circleci --create-home circleci && \
echo 'circleci ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-circleci && \
echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep && \
sudo -u circleci mkdir /home/circleci/project && \
sudo -u circleci mkdir /home/circleci/bin && \
sudo -u circleci mkdir -p /home/circleci/.local/bin && \
\
dockerizeArch=arm64 && \
if uname -p | grep "x86_64"; then \
dockerizeArch=x86_64; \
fi && \
curl -sSL --fail --retry 3 --output /usr/local/bin/dockerize "https://github.com/powerman/dockerize/releases/download/v0.8.0/dockerize-linux-${dockerizeArch}" && \
chmod +x /usr/local/bin/dockerize && \
dockerize --version
ENV PATH=/home/circleci/bin:/home/circleci/.local/bin:$PATH \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
RUN noInstallRecommends="" && \
if [[ "%%VERSION_FULL%%" == "22.04" ]]; then \
noInstallRecommends="--no-install-recommends"; \
fi && \
apt-get update && apt-get install -y $noInstallRecommends \
autoconf \
build-essential \
ca-certificates \
cmake \
# already installed but here for consistency
curl \
file \
gettext-base \
gnupg \
gzip \
jq \
libcurl4-openssl-dev \
libmagic-dev \
# popular DB lib - MariaDB
libmariadb-dev \
# allows MySQL users to use MariaDB lib
libmariadb-dev-compat \
# popular DB lib - PostgreSQL
libpq-dev \
libssl-dev \
libsqlite3-dev \
lsof \
make \
# for ssh-enabled builds
nano \
net-tools \
netcat \
openssh-client \
parallel \
# compiling tool
pkg-config \
postgresql-client \
python-is-python3 \
retry \
shellcheck \
software-properties-common \
# already installed but here for consistency
sudo \
tar \
tzdata \
unzip \
# for ssh-enabled builds
vim \
wget \
zip && \
# get the semi-official latest-stable git instead of using the old(er) version from the ubuntu distro
add-apt-repository ppa:git-core/ppa && apt-get install -y git && \
# get the semi-official latest-stable git-lfs too
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && apt-get install -y git-lfs && \
# Quick test of the git & git-lfs install
git version && git lfs version && \
# Smoke test for python aliasing
python --version && \
rm -rf /var/lib/apt/lists/*
# Install Docker - needs the setup_remote_docker CircleCI step to work
ENV DOCKER_VERSION 5:25.0.3-1~ubuntu
RUN apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository -y "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $( lsb_release -cs ) stable" && \
apt-get install -y docker-ce=${DOCKER_VERSION}.$( lsb_release -rs )~$( lsb_release -cs ) docker-ce-cli=${DOCKER_VERSION}.$( lsb_release -rs )~$( lsb_release -cs ) containerd.io && \
# Quick test of the Docker install
docker --version && \
rm -rf /var/lib/apt/lists/*
# Install Docker Compose - see prerequisite above
ENV COMPOSE_VER 2.27.1
ENV COMPOSE_SWITCH_VERSION 1.0.5
RUN dockerPluginDir=/usr/local/lib/docker/cli-plugins && \
mkdir -p $dockerPluginDir && \
curl -sSL "https://github.com/docker/compose/releases/download/v${COMPOSE_VER}/docker-compose-linux-$(uname -m)" -o $dockerPluginDir/docker-compose && \
chmod +x $dockerPluginDir/docker-compose && \
curl -fL "https://github.com/docker/compose-switch/releases/download/v${COMPOSE_SWITCH_VERSION}/docker-compose-linux-$(dpkg --print-architecture)" -o /usr/local/bin/compose-switch && \
# Quick test of the Docker Compose install
docker compose version && \
chmod +x /usr/local/bin/compose-switch && \
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99 && \
# Tests if docker-compose for v1 is transposed to v2
docker-compose version
RUN YQ_ARCH=$(dpkg --print-architecture) && \
curl -sSL "https://github.com/mikefarah/yq/releases/download/v4.42.1/yq_linux_$YQ_ARCH.tar.gz" | \
tar -xz -C /usr/local/bin && \
mv /usr/local/bin/yq{_linux_$YQ_ARCH,}
USER circleci
# Run commands and tests as circleci user
RUN whoami && \
# opt-out of the new security feature, not needed in a CI environment
git config --global --add safe.directory '*'
# Match the default CircleCI working directory
WORKDIR /home/circleci/project