Skip to content

Instantly share code, notes, and snippets.

@melix
Last active June 2, 2020 01:37
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save melix/e4b63fd684e63713c162 to your computer and use it in GitHub Desktop.
Save melix/e4b63fd684e63713c162 to your computer and use it in GitHub Desktop.
Dockerfile for Groovy
################################################
# Dockerfile to run Groovy containers
# Based on Java 8 image
################################################
FROM java:8u40-jdk
MAINTAINER Cédric Champeau
# Install GVM
RUN curl -s get.gvmtool.net | bash
RUN ["/bin/bash", "-c", "source /root/.gvm/bin/gvm-init.sh"]
RUN echo "gvm_suggestive_selfupdate=false" >> /root/.gvm/etc/config
RUN ["/bin/bash", "-c", "-l", "gvm install groovy"]
# Fix path
ENV GROOVY_HOME /root/.gvm/groovy/current
ENV PATH $GROOVY_HOME/bin:$PATH
@dgageot
Copy link

dgageot commented Nov 27, 2014

This whole section is not needed:

RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install unzip curl

You might also want set an entrypoint that points to groovy

@dgageot
Copy link

dgageot commented Nov 27, 2014

I don't think RUN ["/bin/bash", "-c", "source /root/.gvm/bin/gvm-init.sh"] is needed either

@melix
Copy link
Author

melix commented Nov 27, 2014

Wouldn't an entrypoint limit the container to a single command? (here groovy) where I could want to use groovy, groovysh, groovyc and friends?

@dgageot
Copy link

dgageot commented Nov 27, 2014

yes it would.

@melix
Copy link
Author

melix commented Dec 5, 2014

A smaller image variant, which uses an explicit version and does not require GVM:

################################################
# Dockerfile to run Groovy containers
# Based on Java 8 image
################################################

FROM debian:latest

MAINTAINER Cédric Champeau

RUN apt-get update && \
    apt-get upgrade && \
    apt-get -y install wget unzip && \
    apt-get clean

RUN cd /tmp && \
    wget --no-check-certificate http://www.java.net/download/jdk8u40/archive/b15/binaries/jdk-8u40-ea-bin-b15-linux-x64-18_nov_2014.tar.gz && \
    tar xzf jdk-8u40-ea-bin-b15-linux-x64-18_nov_2014.tar.gz && \
    mv jdk1.8.0_40 /jdk && \
    rm -f jdk-8u40-ea-bin-b15-linux-x64-18_nov_2014.tar.gz

RUN cd /tmp && \
    wget http://dl.bintray.com/groovy/maven/groovy-binary-2.4.0-beta-4.zip && \
    unzip groovy-binary-2.4.0-beta-4.zip && \
    mv groovy-2.4.0-beta-4 /groovy && \
    rm groovy-binary-2.4.0-beta-4.zip

ENV JAVA_HOME /jdk
ENV GROOVY_HOME /groovy
ENV PATH $GROOVY_HOME/bin/:$PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment