This directory contains Dockerfiles to create new Docker images for
running Checker Framework tests reproducibly.

The rest of this file explains how to build new Docker images.


Preliminaries:

  # Finish docker setup if necessary.
  sudo usermod -aG docker $(whoami)
  # Then log out and back in.

  # Obtain Docker credentials.
  # (This is only necessary once per machine; credentials are cached.)
  docker login

After running any of the below, consider deleting the docker containers,
which can take up a lot of disk space.
To stop and remove/delete all docker containers:
  docker stop $(docker ps -a -q)
  docker rm $(docker ps -a -q)
or you can just remove some of them.

Create the Docker image:

# Alias to create the Docker image, in an empty directory, and upload to Docker Hub.
# Run from a terminal, NOT from Emacs, because it produces vast amounts of output.
# Takes about 12 minutes for jdk*, about 1 hour for jdk*-plus.
DOCKERTESTING=""
# When DOCKERTESTING is enabled, also edit any file containing the string "mdernst/".
# DOCKERTESTING="-testing"
alias create_upload_docker_image=' \
  ( [ -z "$INSIDE_EMACS" ] || (echo "Do not run within Emacs" && false) ) && \
  (rm -rf dockerdir && \
  mkdir -p dockerdir && \
  cd dockerdir && \
  \cp -pf ../Dockerfile-$OS-$JDKVER Dockerfile && \
  DOCKERIMAGE="mdernst/$DPROJECT-$OS-$JDKVER$DOCKERTESTING" && \
  docker build -t $DOCKERIMAGE . && \
  docker push $DOCKERIMAGE && \
  rm -rf dockerdir) || \
  (echo "*****"; echo "*****"; echo "FAILURE in $DOCKERIMAGE"; echo "*****"; echo "*****"; false) \
'

export OS=ubuntu
export JDKVER=jdk11
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk11-plus
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk17
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk17-plus
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk21
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk21-plus
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk23
export DPROJECT=cf
create_upload_docker_image

export OS=ubuntu
export JDKVER=jdk23-plus
export DPROJECT=cf
create_upload_docker_image


Cleanup:

After creating docker images, if you are low on disk space,
consider deleting the docker containers.
To stop and remove/delete all docker containers:
  docker stop $(docker ps -a -q)
  docker rm $(docker ps -a -q)
or you can just remove some of them.
