Public Repository

Last pushed: 2 years ago
Short Description
A container for bootstrapping the creation of Clojure web apps.
Full Description

Working with this image

Creating a Clojure web app

This container will bootstrap a Docker ready Clojure web app based on this container and using this lein template. In order to create a web app run the following command:

$ docker run -v `pwd`:/artifact garycrawford/clojure-webapp-bootstrap "my-app"

Building the web app

You can build the web app container by running:

$ cd my-app
$ docker build -t my-app .

This will result in the creation of an uberjar and the deletion of the source code from the container. This is to prevent settings and code intended only for the development environment making into a production container.

Running the web app

Once built, the web app can be started with:

$ docker run -p 1234:1234 -d my-app
$ curl http://localhost:1234
  {"msg":"home place holder"}

Out of the box the web app has two routes:

  • GET /
  • GET /healthcheck

Developing the web app

Start by running the following command in the root of the app:

# use -v to share the code directory across the host and container 
$ docker run -p 1234:1234 -v `pwd`:/usr/src/app -it my-app lein repl

This allows the app to be developed and updated on the host using the IDE of your choice while the web app continues to run inside the container.

Docker Pull Command