# Create a Docker image that is ready to run the full Checker Framework tests,
# including building the manual and Javadoc, using JDK 17.

# "ubuntu" is the latest LTS release.  "ubuntu:rolling" is the latest release.
FROM ubuntu
MAINTAINER Michael Ernst <mernst@cs.washington.edu>

## Keep this file in sync with ../../docs/manual/troubleshooting.tex

# According to
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/:
#  * Put "apt-get update" and "apt-get install" and apt cleanup in the same RUN command.
#  * Do not run "apt-get upgrade"; instead get upstream to update.

# Instructions for installing Java 17 on Ubuntu:
# https://www.linuxuprising.com/2021/09/how-to-install-oracle-java-17-lts-on.html
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& apt-get -qqy install software-properties-common \
&& add-apt-repository ppa:linuxuprising/java

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& echo oracle-java17-installer shared/accepted-oracle-license-v1-3 select true | /usr/bin/debconf-set-selections \
&& echo oracle-java17-installer shared/accepted-oracle-licence-v1-3 boolean true | /usr/bin/debconf-set-selections \
&& apt-get -qqy install \
  oracle-java17-installer --install-recommends

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& apt-get -qqy install \
  ant \
  cpp \
  git \
  gradle \
  jq \
  libcurl3-gnutls \
  make \
  maven \
  mercurial \
  python3-pip \
  python3-requests \
  unzip \
  wget

RUN export DEBIAN_FRONTEND=noninteractive \
&& wget https://mirrors.sonic.net/apache/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz \
&& tar xzvf apache-maven-3.8.3-bin.tar.gz
ENV PATH="/apache-maven-3.8.3/bin:$PATH"

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qqy update \
&& apt-get -qqy install \
  devscripts \
  dia \
  hevea \
  imagemagick \
  latexmk \
  librsvg2-bin \
  pdf2svg \
  rsync \
  shellcheck \
  texlive-font-utils \
  texlive-fonts-recommended \
  texlive-latex-base \
  texlive-latex-extra \
  texlive-latex-recommended

RUN pip3 install black flake8 html5validator

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
