Skip to content

Commit edd5c25

Browse files
jdbrettlangdonKyle-Verhoog
authored
ci: import our Dockerfile in the repository (#1227)
That should make it easier to manage our CI image. Co-authored-by: Brett Langdon <[email protected]> Co-authored-by: Kyle Verhoog <[email protected]>
1 parent d6e7d69 commit edd5c25

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.circleci/config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ s3_bucket: &s3_bucket pypi.datadoghq.com
66

77
resource_class: &resource_class medium
88
busybox_image: &busybox_image busybox:latest
9+
cimg_base_image: &cimg_base_image cimg/base:2020.01
910
python38_image: &python38_image circleci/python:3.8
1011
python37_image: &python37_image circleci/python:3.7
1112
python36_image: &python36_image circleci/python:3.6
@@ -165,6 +166,10 @@ commands:
165166

166167

167168
executors:
169+
cimg_base:
170+
docker:
171+
- image: *cimg_base_image
172+
resource_class: *resource_class
168173
python38:
169174
docker:
170175
- image: *python38_image
@@ -246,6 +251,15 @@ jobs:
246251
- run: tox -e 'flake8' --result-json /tmp/flake8.results
247252
- save_results
248253

254+
build-docker-ci-image:
255+
executor: cimg_base
256+
steps:
257+
- checkout
258+
- setup_remote_docker:
259+
docker_layer_caching: true
260+
- run: |
261+
docker build .
262+
249263
test_build_py38:
250264
executor: python38
251265
steps:
@@ -871,6 +885,7 @@ workflows:
871885
- tracer: *requires_pre_test
872886
- unit_tests: *requires_pre_test
873887
- vertica: *requires_pre_test
888+
- build-docker-ci-image: *requires_pre_test
874889
- verify_all_tests_ran:
875890
requires:
876891
# Individual tests do not need this to start running
@@ -936,6 +951,7 @@ workflows:
936951
- tornado
937952
- unit_tests
938953
- vertica
954+
- build-docker-ci-image
939955
- deploy_master:
940956
requires:
941957
- verify_all_tests_ran

Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# DEV: Use `debian:slim` instead of an `alpine` image to support installing wheels from PyPI
2+
# this drastically improves test execution time since python dependencies don't all
3+
# have to be built from source all the time (grpcio takes forever to install)
4+
FROM debian:stretch-slim
5+
6+
# http://bugs.python.org/issue19846
7+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
8+
ENV LANG C.UTF-8
9+
10+
RUN \
11+
# Install system dependencies
12+
apt-get update \
13+
&& apt-get install -y --no-install-recommends \
14+
build-essential \
15+
ca-certificates \
16+
curl \
17+
git \
18+
jq \
19+
libbz2-dev \
20+
libffi-dev \
21+
liblzma-dev \
22+
libmariadb-dev \
23+
libmariadb-dev-compat \
24+
libmemcached-dev \
25+
libmemcached-dev \
26+
libncurses5-dev \
27+
libncursesw5-dev \
28+
libpq-dev \
29+
libreadline-dev \
30+
libsasl2-dev \
31+
libsqlite3-dev \
32+
# Needed to support Python 3.4
33+
libssl1.0-dev \
34+
# Can be re-enabled once we drop 3.4
35+
# libssh-dev \
36+
# libssl-dev \
37+
patch \
38+
python-openssl\
39+
wget \
40+
zlib1g-dev \
41+
# Cleaning up apt cache space
42+
&& rm -rf /var/lib/apt/lists/*
43+
44+
45+
# Configure PATH environment for pyenv
46+
ENV PYENV_ROOT /root/.pyenv
47+
ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:$PATH
48+
49+
# Install pyenv
50+
RUN git clone git://github.com/yyuu/pyenv.git "${PYENV_ROOT}"
51+
52+
53+
# Install all required python versions
54+
RUN \
55+
pyenv install 2.7.17 \
56+
&& pyenv install 3.4.9 \
57+
&& pyenv install 3.5.9 \
58+
&& pyenv install 3.6.9 \
59+
&& pyenv install 3.7.6 \
60+
&& pyenv install 3.8.1 \
61+
&& pyenv install 3.9-dev \
62+
&& pyenv global 2.7.17 3.4.9 3.5.9 3.6.9 3.7.6 3.8.1 3.9-dev \
63+
&& pip install --upgrade pip
64+
65+
# Install Python dependencies
66+
# DEV: `tox==3.7` introduced parallel execution mode
67+
# https://tox.readthedocs.io/en/3.7.0/example/basic.html#parallel-mode
68+
RUN pip install "tox>=3.7,<4.0"
69+
70+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)