Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titledocker-compose.yml
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
   - /tmp/.X11-unix:/tmp/.X11-unix:rw
   - ${ALMA_DIR}/${CONTAINER_OS}:/alma
   - ./${CONTAINER_OS}/working:/working:z

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

services:
   fedora26:
      <<: *common
   fedora27:
      <<: *common
   fedora28:
      <<: *common
   fedora29:
      <<: *common
   fedora30:
      <<: *common
   fedora31:
      <<: *common
   centos6:
      <<: *common
   centos7:
      <<: *common
   centos8:
      <<: *common

Docker Compose .env

...

.env

...

  • USER_ID: Id of local user executing docker instance
  • GROUP_ID: Group id from local user executing docker instance
  • ALMA_DIR: Path that has all the directories that will be mounted as /alma in the container, for instance in my examples is '/external/docker/'
    • Inside this directory there's a set of directories for each OS, each will be mounted as /alma for the different images/containers. For instance '/external/docker/centos7' will be mounted as /alma in centos7 containers.
  • REPO_DIR: Path to the Git Repository. In my case inside this path (/external/Repos) I have 'almasw' and 'worktrees', which allow to have several worktrees for building without affecting other parts of the system
  • CONTAINER_OS: Here I define the default OS to be used. This can be overridden on command line if other OS is going to be used, but the default one should be defined here

An example of the .env file:

Code Block
title.env example
USER_ID=1000
GROUP_ID=1000
ALMA_DIR=/external/docker
REPO_DIR=/external/Repos
CONTAINER_OS=centos7