Skip to content

Commit

Permalink
Add centos8 images based on conda.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Nov 25, 2022
1 parent cdd2f67 commit a8d9a05
Show file tree
Hide file tree
Showing 13 changed files with 346 additions and 81 deletions.
108 changes: 84 additions & 24 deletions .github/workflows/deploy_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:
required: false
default: 'false'
specific_job:
description: Run a specific job? (py27|py36|py37|py38|py39|py310|py311|example)
description: Run a specific job? (py27|py36|py37|py38|py39|py310|py311|c7|c8|example)
required: false
default: ''

jobs:
py27:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py27') }}
c7-py27:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py27') || contains(github.event.inputs.specific_job, 'py27') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -28,13 +28,13 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py27
repository: riga/law
tags: py27,py2
tags: c7-py27,py27,py2
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

py36:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py36') }}
c7-py36:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py36') || contains(github.event.inputs.specific_job, 'py36') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -48,13 +48,13 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py36
repository: riga/law
tags: py36
tags: c7-py36,py36
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

py37:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py37') }}
c7-py37:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py37') || contains(github.event.inputs.specific_job, 'py37') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -68,13 +68,33 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py37
repository: riga/law
tags: py37
tags: c7-py37
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

py38:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py38') }}
c8-py37:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c8-py37') || contains(github.event.inputs.specific_job, 'py37') || contains(github.event.inputs.specific_job, 'c8') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Build and deploy image 🐳
uses: docker/build-push-action@v1
with:
path: docker
dockerfile: docker/Dockerfile_centos8_py37
repository: riga/law
tags: c8-py37,py37
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

c7-py38:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py38') || contains(github.event.inputs.specific_job, 'py38') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -88,13 +108,33 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py38
repository: riga/law
tags: py38
tags: c7-py38
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

c8-py37:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c8-py38') || contains(github.event.inputs.specific_job, 'py38') || contains(github.event.inputs.specific_job, 'c8') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Build and deploy image 🐳
uses: docker/build-push-action@v1
with:
path: docker
dockerfile: docker/Dockerfile_centos8_py38
repository: riga/law
tags: c8-py38,py38
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

py39:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py39') || contains(github.event.inputs.specific_job, 'example') }}
c7-py39:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py39') || contains(github.event.inputs.specific_job, 'py39') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -108,13 +148,33 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py39
repository: riga/law
tags: py39,py3,latest
tags: c7-py39,c7-py3
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

c8-py39:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c8-py39') || contains(github.event.inputs.specific_job, 'py39') || contains(github.event.inputs.specific_job, 'c8') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Build and deploy image 🐳
uses: docker/build-push-action@v1
with:
path: docker
dockerfile: docker/Dockerfile_centos8_py39
repository: riga/law
tags: c8-py39,c8-py3,c8,py39,py3,latest
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

py310:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py310') }}
c7-py310:
if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py310') || contains(github.event.inputs.specific_job, 'py310') || contains(github.event.inputs.specific_job, 'c7') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -128,14 +188,14 @@ jobs:
path: docker
dockerfile: docker/Dockerfile_centos7_py310
repository: riga/law
tags: py310
tags: c7-py310,py310
push: ${{ github.event.inputs.build_only != 'true' }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# NOTE: disabled for now due to some gfal2-bindings issue
# py311:
# if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'py311') }}
# c7-py311:
# if: ${{ github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'c7-py311') || contains(github.event.inputs.specific_job, 'py311') || contains(github.event.inputs.specific_job, 'c7') }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout 🛎️
Expand All @@ -149,14 +209,14 @@ jobs:
# path: docker
# dockerfile: docker/Dockerfile_centos7_py311
# repository: riga/law
# tags: py311
# tags: c7-py311
# push: ${{ github.event.inputs.build_only != 'true' }}
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

example:
if: ${{ github.event.inputs.build_only != 'true' && (github.event.inputs.specific_job == '' || contains(github.event.inputs.specific_job, 'example')) }}
needs: py39
needs: c8-py39
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -168,7 +228,7 @@ jobs:
uses: docker/build-push-action@v1
with:
path: docker
dockerfile: docker/Dockerfile_centos7_example
dockerfile: docker/Dockerfile_example
repository: riga/law
tags: example
push: true
Expand Down
77 changes: 77 additions & 0 deletions docker/Docker_centos8_py37
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM centos:8

# labels
LABEL law.version="0.1.8"
LABEL law.image_name="riga/law"
LABEL law.image_tag="c8-py37"
LABEL law.image_os="centos8"
LABEL law.image_python_major="3"
LABEL law.image_python_minor="7"
LABEL law.image_python="3.7"

# law specific environment variables
ENV LAW_IMAGE_ROOT /root/law
ENV LAW_IMAGE_NAME riga/law
ENV LAW_IMAGE_TAG c8-py37
ENV LAW_IMAGE_PYTHON_MAJOR 3
ENV LAW_IMAGE_PYTHON_MINOR 7
ENV LAW_IMAGE_PYTHON ${LAW_IMAGE_PYTHON_MAJOR}.${LAW_IMAGE_PYTHON_MINOR}
ENV LAW_CONDA_ROOT /root/conda
ENV LAW_CONDA_VERSION 4.12.0
ENV LAW_CONDA_INSTALL_FILE https://repo.anaconda.com/miniconda/Miniconda${LAW_IMAGE_PYTHON_MAJOR}-py${LAW_IMAGE_PYTHON_MAJOR}${LAW_IMAGE_PYTHON_MINOR}_${LAW_CONDA_VERSION}-Linux-x86_64.sh
ENV LAW_SANDBOX docker::riga/law:c8-py37,docker::riga/law:py37

# exposed ports
EXPOSE 8082

# bash files
COPY bash_profile /root/.bash_profile
COPY bashrc /root/.bashrc

# installation workdir
WORKDIR /root/install

# prepare yum
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN sed -i -r 's/^(override_install_langs=.+)/#\1/' /etc/yum.conf
RUN yum -y update; yum clean all
RUN yum -y install yum-utils epel-release wget; yum clean all

# setup conda
ENV PATH ${LAW_CONDA_ROOT}/bin:${PATH}
RUN wget "${LAW_CONDA_INSTALL_FILE}" -O setup_miniconda.sh -q && \
bash setup_miniconda.sh -b -u -p "${LAW_CONDA_ROOT}" && \
rm setup_miniconda.sh
RUN echo $'\n\
changeps1: false\n\
channels:\n\
- conda-forge\n\
- defaults\n\
' >> "${LAW_CONDA_ROOT}/.condarc"
SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]

# conda packages
RUN conda install --yes libgcc gcc which wget nano micro screen git git-lfs cmake ncurses readline && \
conda clean --all
RUN conda install --yes gfal2 gfal2-util python-gfal2 && \
conda clean --all

# python packages
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir --upgrade setuptools
RUN pip install --no-cache-dir slackclient python-telegram-bot
RUN pip install --no-cache-dir flake8 flake8-quotes flake8-commas pytest-cov

# cleanup installation workdir
WORKDIR /root
RUN rm -rf /root/install

# install law master
RUN git clone --recursive https://github.com/riga/law "${LAW_IMAGE_ROOT}" && \
cd "${LAW_IMAGE_ROOT}" && \
pip install --no-cache-dir .
WORKDIR ${LAW_IMAGE_ROOT}

# init command
SHELL ["conda", "run", "-n", "base", "/bin/bash", "-i", "--login"]
77 changes: 77 additions & 0 deletions docker/Docker_centos8_py38
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM centos:8

# labels
LABEL law.version="0.1.8"
LABEL law.image_name="riga/law"
LABEL law.image_tag="c8-py38"
LABEL law.image_os="centos8"
LABEL law.image_python_major="3"
LABEL law.image_python_minor="8"
LABEL law.image_python="3.8"

# law specific environment variables
ENV LAW_IMAGE_ROOT /root/law
ENV LAW_IMAGE_NAME riga/law
ENV LAW_IMAGE_TAG c8-py38
ENV LAW_IMAGE_PYTHON_MAJOR 3
ENV LAW_IMAGE_PYTHON_MINOR 8
ENV LAW_IMAGE_PYTHON ${LAW_IMAGE_PYTHON_MAJOR}.${LAW_IMAGE_PYTHON_MINOR}
ENV LAW_CONDA_ROOT /root/conda
ENV LAW_CONDA_VERSION 4.12.0
ENV LAW_CONDA_INSTALL_FILE https://repo.anaconda.com/miniconda/Miniconda${LAW_IMAGE_PYTHON_MAJOR}-py${LAW_IMAGE_PYTHON_MAJOR}${LAW_IMAGE_PYTHON_MINOR}_${LAW_CONDA_VERSION}-Linux-x86_64.sh
ENV LAW_SANDBOX docker::riga/law:c8-py38,docker::riga/law:py38

# exposed ports
EXPOSE 8082

# bash files
COPY bash_profile /root/.bash_profile
COPY bashrc /root/.bashrc

# installation workdir
WORKDIR /root/install

# prepare yum
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN sed -i -r 's/^(override_install_langs=.+)/#\1/' /etc/yum.conf
RUN yum -y update; yum clean all
RUN yum -y install yum-utils epel-release wget; yum clean all

# setup conda
ENV PATH ${LAW_CONDA_ROOT}/bin:${PATH}
RUN wget "${LAW_CONDA_INSTALL_FILE}" -O setup_miniconda.sh -q && \
bash setup_miniconda.sh -b -u -p "${LAW_CONDA_ROOT}" && \
rm setup_miniconda.sh
RUN echo $'\n\
changeps1: false\n\
channels:\n\
- conda-forge\n\
- defaults\n\
' >> "${LAW_CONDA_ROOT}/.condarc"
SHELL ["conda", "run", "-n", "base", "/bin/bash", "-c"]

# conda packages
RUN conda install --yes libgcc gcc which wget nano micro screen git git-lfs cmake ncurses readline && \
conda clean --all
RUN conda install --yes gfal2 gfal2-util python-gfal2 && \
conda clean --all

# python packages
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir --upgrade setuptools
RUN pip install --no-cache-dir slackclient python-telegram-bot
RUN pip install --no-cache-dir flake8 flake8-quotes flake8-commas pytest-cov

# cleanup installation workdir
WORKDIR /root
RUN rm -rf /root/install

# install law master
RUN git clone --recursive https://github.com/riga/law "${LAW_IMAGE_ROOT}" && \
cd "${LAW_IMAGE_ROOT}" && \
pip install --no-cache-dir .
WORKDIR ${LAW_IMAGE_ROOT}

# init command
SHELL ["conda", "run", "-n", "base", "/bin/bash", "-i", "--login"]
Loading

0 comments on commit a8d9a05

Please sign in to comment.