Configuration

Docker Image

FROM centos:centos7

ARG USER_ID
ARG GROUP_ID

#General packages
RUN yum -y install vim redhat-lsb-core sudo dbus-x11

#Install Git and Git LFS
RUN yum -y install epel-release
RUN yum -y install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
RUN yum -y install git
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash
RUN yum -y install git-lfs

#Install Java 11
RUN yum -y install java-11-openjdk-devel

#Prepare for Java
RUN mkdir /usr/java
RUN ln -s /usr/lib/jvm/java-openjdk /usr/java/default

#Install ACS required packages
RUN yum -y install ksh gcc gcc-c++ libX11-devel libffi-devel perl readline-devel bzip2 bzip2-devel openssl-devel openldap-devel libxml2-devel freetype-devel libxslt-devel sqlite-devel expat-devel bison flex autoconf unzip

#ARCHIVE
RUN yum -y install libtool libdb-devel

#ICD
RUN yum -y install cmake blas-devel cfitsio-devel wcslib-devel lapack-devel

#CONTROL
RUN yum -y install binutils-devel libmemcached-devel
#CORRCommon
RUN yum -y install kernel kernel-devel procmail

#TELCAL
RUN yum -y install motif-devel texlive

#User configuration
RUN groupadd -r -g ${GROUP_ID} almamgr
RUN useradd -r -m -u ${USER_ID} -g almamgr almamgr
RUN groupadd sudo
RUN usermod -aG sudo almamgr
RUN echo test |passwd almamgr --stdin
RUN echo "%sudo ALL=(ALL)       ALL" >> /etc/sudoers
RUN echo "%sudo ALL=(ALL)       NOPASSWD: ALL" >> /etc/sudoers
USER almamgr

Docker Compose

version: "3.4"

x-args: &args
   USER_ID: ${USER_ID}
   GROUP_ID: ${GROUP_ID}

x-env: &env
   - DISPLAY=${DISPLAY}

x-volumes: &volumes
   - ${REPO_DIR}:/Repos
   - ${ALMA_DIR}/${CONTAINER_OS}:/alma
   - ./${CONTAINER_OS}/working:/working:z
   - /tmp/.X11-unix:/tmp/.X11-unix:rw

x-acs-images: &common
   build:
      dockerfile: Dockerfile
      context: ./${CONTAINER_OS}
      args:
         *args
   image: acs-${CONTAINER_OS}
   environment:
      *env
   volumes:
      *volumes
   working_dir: /working

services:
   centos6:
      <<: *common
   centos7:
      <<: *common
   centos8:
      <<: *common

Docker Compose .env

An example of the .env file:

USER_ID=1000
GROUP_ID=1000
ALMA_DIR=/external/docker
REPO_DIR=/external/Repos
CONTAINER_OS=centos7

Makefile

images:=$(wildcard fedora*) $(wildcard centos*)
build: $(images)
.PHONY: $(images)
$(images):
        @CONTAINER_OS=$@ docker-compose build $@
$(addprefix up-,$(images)):
        @CONTAINER_OS=$(subst up-,,$@) docker-compose up $(subst up-,,$@)

$(addprefix down-,$(images)):
        @CONTAINER_OS=$(subst down-,,$@) docker-compose down


make centos7


Example directory tree

.
├── centos6
│   ├── Dockerfile
│   └── working
│       ├── acs.env
│       ├── buildExtProds.sh
│       └── working
│           ├── acs.env
│           ├── buildACS.sh
│           ├── buildALMASW.sh
│           ├── buildCommon.sh
│           └── buildExtProds.sh
├── centos7
│   ├── Dockerfile
│   └── working
│       ├── acs.env
│       ├── buildACS.sh
│       ├── buildALMASW.sh
│       ├── buildCommon.sh
│       └── buildExtProds.sh
├── centos8
│   ├── Dockerfile
│   └── working
│       └── working
│           ├── acs.env
│           ├── buildACS.sh
│           ├── buildALMASW.sh
│           ├── buildCommon.sh
│           └── buildExtProds.sh
├── docker-compose.yml
├── .env
└── Makefile

Execution

#Executing centos7
docker-compose run centos7 bash
#Executing centos6 requires to define the CONTAINER_OS variable
CONTAINER_OS=centos6 docker-compose run centos7 bash