Skip to content

A Grails executable container based on dockerfile/java:oracle-java7

License

Notifications You must be signed in to change notification settings

danker/docker-grails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

#Grails Container

This docker image includes OpenJDK 8 and Grails 2.5.0 for use in developing Grails applications (with the Grails cli as the endpoint).

Usage

Default Behavior

By defaut, running this image without any command will run grails -version in the /app directory. Thus, you should mount your project in /app. For example, a more interesting command would be test-running your app.

# For files on the dockerhost
docker run --rm -v /path/to/your/project:/app:rw -p 80:8080 --name grails edanker/grails grails run-app

# For a data container
docker run --rm --link data-container-name:data -p 80:8080 --name grails edanker/grails grails run-app

Versatility

Of course, you can use any command here, and take notice that grails is the entrypoint. So, to create an application, run the following:

docker run --rm -v /path/to/dir:/app:rw --name grails edanker/grails create-app helloworld

Interactive Mode

Downloading a whole bunch of things each time you run the container is a pain -- not to mention a huuge bandwidth sink ( for everyone else stuck in 1995 internet with me ). A nice feature of Grails is its interactive mode. Also useful if you find yourself starting a grails container frequently, you can set the docker switches -i and -t and the grails switch --interactive (see example). This overrides the default CMD (-version) if you didn't change it.

docker run -it --rm -v /path/to/project:/app:rw --name grails edanker/grails --interactive

Building On This Container

Obviously, grails -version is not a very interesting command. So, when want to customize or get annoyed with changing your project's user and group, you can build off of this image and tweak all the settings, install more packages, etc:

FROM edanker/grails
MAINTAINER your-name-here <email@you.com>

# In case someone loses the Dockerfile
RUN rm -rf /etc/Dockerfile
ADD Dockerfile /etc/Dockerfile

# Add your desired user and group
RUN groupadd your-group-name
RUN useradd -s /bin/bash -m -d /app -g your-group-name your-user-name

# Set your desired user as default
USER your-user-name

# Whatever default behavior you want
ENTRYPOINT ["grails"]
CMD ["run-app"]

Get the Image

To build this image yourself, run...

docker build github.com/edanker/docker-grails

Or, you can pull the image from the central docker repository by using...

docker pull edanker/grails

About

A Grails executable container based on dockerfile/java:oracle-java7

Resources

License

Stars

Watchers

Forks

Packages

No packages published