Skip to content

Commit

Permalink
Update Dockerfile for better compatibility
Browse files Browse the repository at this point in the history
This includes:
- Installing more recent Gradle
- Running setup commands in a bash login shell
- Pinning the Poetry version
- a few other minor tweaks
  • Loading branch information
Michionlion committed Sep 18, 2020
1 parent df5b57c commit 6da0421
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ ENV PROJECT_DIR=/project/
# Expecting volume mount at
ENV GATORGRADER_DIR=/root/.local/share/

# Set Python version
ARG PYTHON_VERSION='3.8.5'

# Configure environment variables for Python
# Configure environment variables
ENV PYTHONUNBUFFERED=1 \
# Prevent Python from creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
Expand All @@ -36,29 +33,37 @@ ENV PYTHONUNBUFFERED=1 \
# Specify the paths for using requirements and virtual environments;
# this is where the requirements + virtual environment will live
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv"
VENV_PATH="/opt/pysetup/.venv" \
# Specify the version of Gradle
GRADLE_VERSION=5.4.1 \
# Specify the home directory of Gradle
GRADLE_HOME="/opt/gradle-5.4.1"

# Pre-pend Poetry's home and the .venv directory to PATH
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH:"
# Pre-pend Gradle's bin to PATH
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$GRADLE_HOME/bin:$PATH"

# Define the project directory as the working directory
WORKDIR ${PROJECT_DIR}

# Specify shared volume storage in the container
VOLUME ${PROJECT_DIR} ${GATORGRADER_DIR}

# hadolint ignore=DL3008,DL3013,DL3015,DL3016,DL3018,DL3028
RUN set -ex && echo "Installing Packages with apt-get..." \
# Tell Docker to use a bash login shell for RUN commands
SHELL ["/bin/bash", "--login", "-c"]

# hadolint ignore=DL3008,DL3013,DL3016,DL3018,DL3028
RUN set -e && echo "Installing Packages with apt-get..." \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get -y install --no-install-recommends bash git ruby openjdk-11-jdk gradle npm \
&& apt-get -y install --no-install-recommends ruby openjdk-11-jdk npm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Installing Pandoc..." \
&& wget -O /pandoc.tar.gz https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-linux-amd64.tar.gz \
&& tar -C /usr --strip-components 1 -xzvf /pandoc.tar.gz && rm /pandoc.tar.gz \
&& echo "Testing Pandoc..." \
&& /usr/bin/pandoc --version \
&& pandoc --version \
&& echo "Installing Markdown Linter called mdl..." \
&& gem install mdl \
&& echo "Installing HTML Linter called htmlhint..." \
Expand All @@ -69,12 +74,17 @@ RUN set -ex && echo "Installing Packages with apt-get..." \
&& echo "Testing Pip..." && pip --version \
&& echo "Installing Poetry..." \
&& wget -O /get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py \
&& python /get-poetry.py && rm /get-poetry.py \
&& python /get-poetry.py --version $POETRY_VERSION && rm /get-poetry.py \
&& source $POETRY_HOME/env \
&& echo "Testing Poetry..." && poetry --version \
&& echo "Installing Pipenv..." \
&& pip install pipenv \
&& echo "Testing Pipenv..." && pipenv --version \
&& echo "Installing Gradle..." \
&& wget -O /gradle-bin.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" \
&& unzip /gradle-bin.zip -d /opt && rm /gradle-bin.zip \
&& echo "Configuring Gradle..." \
&& export PATH="$GRADLE_HOME/bin:$PATH" \
&& mkdir -p /root/.gradle/ \
&& echo "org.gradle.daemon=true" >> /root/.gradle/gradle.properties \
&& echo "systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false" >> /root/.gradle/gradle.properties \
Expand Down

0 comments on commit 6da0421

Please sign in to comment.