Skip to content

Commit

Permalink
add initial dockerfile (#205)
Browse files Browse the repository at this point in the history
* add initial dockerfile

* move config file

* set host
  • Loading branch information
AndreaCrotti authored May 17, 2020
1 parent 8f470a0 commit 5fb85a7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.lein-env
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM circleci/clojure:lein-2.9.1 AS builder
USER root
COPY . /app

WORKDIR /app
RUN lein uberjar


FROM openjdk:14-alpine

RUN mkdir -p /app /app/resources

COPY --from=builder /app/target/*.jar /app/
COPY --from=builder /app/resources /app/resources

WORKDIR /app

CMD java -jar byf.jar
EXPOSE 3335
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
:source-paths ["src/cljc" "src/clj" "src/cljs"]
:test-paths ["test/clj" "test/cljc"]
:ring {:handler byf.api/app}
:resource-paths ["config" "resources"]
:resource-paths ["resources"]

;; :main ^:skip-aot datomic-app.core
:migratus {:store :database
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/clj/byf/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
(wrap-oauth2 oauth2-config)))

(defn -main [& args]
(jetty/run-jetty app {:port (-> :port
(jetty/run-jetty app {:host "0.0.0.0"
:port (-> :port
value
Integer/parseInt)}))
4 changes: 3 additions & 1 deletion src/clj/byf/config.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns byf.config
(:require [environ.core :refer [env]]
[clojure.java.io :as io]
[aero.core :as aero]))

(defonce config (atom nil))
Expand All @@ -10,7 +11,8 @@
;; the dev profile always reloads even `config.edn`
(if (or (= :dev profile)
(nil? @config))
(reset! config (aero/read-config "config.edn" {:profile profile})))
(reset! config (aero/read-config (io/resource "config.edn")
{:profile profile})))

;; if there is a `user.edn` file load that as well and merge it
(if (.exists (java.io.File. "user.edn"))
Expand Down

0 comments on commit 5fb85a7

Please sign in to comment.