Skip to content

Commit

Permalink
Add creation of the conda-ci-linux-64 container (conda#10795)
Browse files Browse the repository at this point in the history
* Add creation of the conda-ci-linux-64 container

The logic moved from https://github.com/ContinuumIO/docker-images

While the Dockerfile is untouched, the github action was updated to use
a build matrix, to publish to ghcr.io and to specify the Python version in
the image tag instead of the image name.

* Adapt to review findings

* Add Dockerfile linting with hadolint
  • Loading branch information
dbast authored Aug 3, 2021
1 parent c42f4bd commit ede6f60
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Publish Conda CI Images
on:
schedule:
- cron: '0 0 * * 0'
pull_request:
paths:
- 'ci/Dockerfile'
- '.github/workflows/ci_image.yml'
push:
paths:
- 'ci/Dockerfile'
- '.github/workflows/ci_image.yml'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2

- name: lint
uses: hadolint/[email protected]
with:
dockerfile: ./ci/Dockerfile

- name: build-push conda-ci-linux-64-python-${{ matrix.python }}
uses: docker/build-push-action@v2
with:
context: ./ci
file: ./ci/Dockerfile
build-args: PYTHON_VERSION=${{ matrix.python }}
tags: conda/conda-ci-linux-64:python${{ matrix.python }}-latest
push: ${{ github.ref == 'refs/heads/master' }}

43 changes: 43 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM debian:buster-slim

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH

# hadolint ignore=DL3008
RUN apt-get update --fix-missing && \
apt-get install -y --no-install-recommends tini wget build-essential bzip2 ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1 git mercurial subversion sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
useradd -m -s /bin/bash test_user && \
usermod -u 1001 test_user && \
groupmod -g 1001 test_user && \
echo "test_user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean --all --yes

ARG PYTHON_VERSION=3.8

# conda and test dependencies
RUN /opt/conda/bin/conda install --update-all -y -c defaults \
conda conda-package-handling \
python=$PYTHON_VERSION pip pycosat requests ruamel_yaml cytoolz \
anaconda-client nbformat make \
pytest pytest-cov codecov radon pytest-timeout mock responses pexpect \
flake8 && \
/opt/conda/bin/conda clean --all --yes

# conda-build and test dependencies
RUN /opt/conda/bin/conda install --update-all -y -c defaults \
conda-build patch git \
perl pytest-xdist pytest-mock \
anaconda-client \
filelock jinja2 conda-verify pkginfo \
glob2 beautifulsoup4 chardet pycrypto \
&& /opt/conda/bin/conda clean --all --yes

USER test_user

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/bin/bash"]

0 comments on commit ede6f60

Please sign in to comment.