<commit_before>(ns docker-clojure.dockerfile
  (:require
   [clojure.java.shell :refer [sh]]
   [clojure.string :as str]
   [docker-clojure.dockerfile.boot :as boot]
   [docker-clojure.dockerfile.lein :as lein]
   [docker-clojure.dockerfile.tools-deps :as tools-deps]
   [docker-clojure.dockerfile.shared :refer :all]))

(defn build-dir [{:keys [base-image build-tool]}]
  (str/join "/" ["target"
                 (str/replace base-image ":" "-")
                 (if (= :docker-clojure.core/all build-tool)
                   "latest"
                   build-tool)]))

(defn all-prereqs [dir variant]
  (tools-deps/prereqs dir variant))

(defn all-contents [installer-hashes variant]
  (concat
    ["### INSTALL BOOT ###"]
    (boot/install
      installer-hashes
      (assoc variant :build-tool-version
             (get-in variant [:build-tool-versions "boot"])))
    ["" "### INSTALL LEIN ###"]
    (lein/install
      installer-hashes
      (assoc variant :build-tool-version
             (get-in variant [:build-tool-versions "lein"])))
    ["" "### INSTALL TOOLS-DEPS ###"]
    (tools-deps/install
      installer-hashes
     (assoc variant :build-tool-version
            (get-in variant [:build-tool-versions "tools-deps"])))
    [""]
    (entrypoint variant)
    ["" "CMD [\"repl\"]"]))

(defn contents [installer-hashes {:keys [build-tool] :as variant}]
  (str/join "\n"
            (concat [(format "FROM %s" (:base-image variant))
                     ""]
                    (case build-tool
                      :docker-clojure.core/all (all-contents installer-hashes variant)
                      "boot" (boot/contents installer-hashes variant)
                      "lein" (lein/contents installer-hashes variant)
                      "tools-deps" (tools-deps/contents installer-hashes variant)))))

(defn shared-prereqs [dir {:keys [build-tool]}]
  (let [entrypoint (case build-tool
                     "tools-deps"             "clj"
                     :docker-clojure.core/all "lein"
                     build-tool)]
    (copy-resource-file dir "entrypoint"
                        #(str/replace % "@@entrypoint@@" entrypoint))))<commit_msg>Use clj as latest entrypoint instead of lein<commit_after>(ns docker-clojure.dockerfile
  (:require
   [clojure.java.shell :refer [sh]]
   [clojure.string :as str]
   [docker-clojure.dockerfile.boot :as boot]
   [docker-clojure.dockerfile.lein :as lein]
   [docker-clojure.dockerfile.tools-deps :as tools-deps]
   [docker-clojure.dockerfile.shared :refer :all]))

(defn build-dir [{:keys [base-image build-tool]}]
  (str/join "/" ["target"
                 (str/replace base-image ":" "-")
                 (if (= :docker-clojure.core/all build-tool)
                   "latest"
                   build-tool)]))

(defn all-prereqs [dir variant]
  (tools-deps/prereqs dir variant))

(defn all-contents [installer-hashes variant]
  (concat
    ["### INSTALL BOOT ###"]
    (boot/install
      installer-hashes
      (assoc variant :build-tool-version
             (get-in variant [:build-tool-versions "boot"])))
    ["" "### INSTALL LEIN ###"]
    (lein/install
      installer-hashes
      (assoc variant :build-tool-version
             (get-in variant [:build-tool-versions "lein"])))
    ["" "### INSTALL TOOLS-DEPS ###"]
    (tools-deps/install
      installer-hashes
     (assoc variant :build-tool-version
            (get-in variant [:build-tool-versions "tools-deps"])))
    [""]
    (entrypoint variant)
    ["" "CMD [\"repl\"]"]))

(defn contents [installer-hashes {:keys [build-tool] :as variant}]
  (str/join "\n"
            (concat [(format "FROM %s" (:base-image variant))
                     ""]
                    (case build-tool
                      :docker-clojure.core/all (all-contents installer-hashes variant)
                      "boot" (boot/contents installer-hashes variant)
                      "lein" (lein/contents installer-hashes variant)
                      "tools-deps" (tools-deps/contents installer-hashes variant)))))

(defn shared-prereqs [dir {:keys [build-tool]}]
  (let [entrypoint (case build-tool
                     "tools-deps"             "clj"
                     :docker-clojure.core/all "clj"
                     build-tool)]
    (copy-resource-file dir "entrypoint"
                        #(str/replace % "@@entrypoint@@" entrypoint))))
{'fraction_non_alphanumeric': 0.15247252747252749, 'fraction_numerical': 0.0, 'mean_word_length': 2.0811001410437235, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1536806', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1375, 'n_words': 280}