Skip to content
Jim Clark edited this page Apr 1, 2022 · 4 revisions

This fork of clojure-polylith-realworld-example-app has a new project that uses jib to package the realworld-backend into a container image. There is an additional project at projects/realworld-backend-jib which demonstrates this packaging.

Testing

Clone or fork https://github.com/slimslenderslacks/clojure-polylith-realworld-example-app.

Build the container using the following commands.

cd projects/realworld-backend-jib
clj -T:jib build

This is configured to build an image to a local docker daemon (tagged with realworld-backend:latest).

Run the container locally

Start up the server in your local docker runtime using the following command.

docker run --rm -it \
           -p 6003:6003 \
           -e ENVIRONMENT=LOCAL \
           -e DATABASE=/home/app/database.db \ 
           -e ALLOWED_ORIGINS=http://localhost:3000 \
           realworld-backend

Why a new project?

The existing project at projects/realworld-backend/deps.edn was designed to run the server in the repl, and uses the furkan3ayraktar/polylith-clj-deps-ring library, which builds a classloader suitable for running a polylith app in a repl; however, this entrypoint is not ideal for a container runtime.

Clone this wiki locally