Create a gist now

Instantly share code, notes, and snippets.

@melix /Dockerfile
Last active Nov 15, 2015

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

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

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

@melix
Owner

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

yes it would.

@melix
Owner

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