Skip to content

Instantly share code, notes, and snippets.

@tstout
Created February 21, 2020 18:58
Show Gist options
  • Select an option

  • Save tstout/49ef70a105b98559f1791f9a6f0e5b2b to your computer and use it in GitHub Desktop.

Select an option

Save tstout/49ef70a105b98559f1791f9a6f0e5b2b to your computer and use it in GitHub Desktop.
Clojure Docker #docker
FROM clojure:tools-deps AS builder
ARG VERSION=0.0.0-0-0000000
ENV TZ=America/Chicago
RUN mkdir -p /home/builder
WORKDIR /home/builder
COPY deps.edn /home/builder
RUN mkdir resources
RUN clojure -Spom
# stash version and build time info as an EDN resource for easy runtime access
RUN clojure -e \
"{:version \"$VERSION\" :buildTime (str (java.time.LocalDateTime/now))}" \
> resources/version.edn
COPY . /home/builder
# build uberjar
RUN clojure -A:depstar -m hf.depstar.uberjar \
sim-faux-manhattan-application-services.jar \
-C -m the-container-store.Sim-Faux-Manhattan-Application-Services
FROM containerstore/java-11-jre
ENV TZ=America/Chicago
WORKDIR /home/app
COPY --from=builder --chown=app:applications /home/builder/* ./
USER app
EXPOSE 8080
CMD java \
-Ddeployment.stack=$DEPLOYMENT_STACK \
-Ddeployment.environment=$DEPLOYMENT_ENVIRONMENT \
-jar sim-faux-manhattan-application-services.jar
HEALTHCHECK --retries=8 CMD curl --silent --fail http://localhost:8080/about || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment