Last active
August 19, 2020 20:45
-
-
Save kwrooijen/a97fd720316e0e07fac60e68feab4a84 to your computer and use it in GitHub Desktop.
A Dockerfile meant for deploying a Clojure Uberjar to Render.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM clojure:openjdk-8-lein-slim-buster AS build-jar | |
# Install any dependencies e.g. NPM for Clojurescript | |
# RUN apt update && apt install npm -y | |
WORKDIR /usr/src | |
COPY . . | |
# Build the uberjar. If you need to prepare certain things for your release | |
# (e.g. build your Clojurescript with Shadow-cljs) you can add a `:prep-tasks` | |
# key to the `:uberjar` profile in your `project.clj`. `lein-shell` can also be | |
# used to execute shell commands such as `npm`. | |
# | |
# >>> project.clj | |
# | |
# :plugins [[lein-shell "0.5.0"]] | |
# :profiles | |
# {:uberjar {:aot :all | |
# :prep-tasks [["shell" "npm" "install"] | |
# ["shell" "shadow-cljs release app"]]}} | |
RUN lein uberjar | |
# By creating a second stage for our Dockerfile, the release image will be | |
# significantly smaller in size. This will be very beneficial for uploading the | |
# image to Render's Docker registry. | |
FROM openjdk:8-jre-alpine | |
WORKDIR /usr/app | |
# Rename `release.jar` to your uberjar name | |
COPY --from=build-jar /usr/src/target/release.jar . | |
CMD ["java", "-jar", "release.jar"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment