From bb948b9ab86140e23fa708940e2bce71b085d261 Mon Sep 17 00:00:00 2001 From: James Tolton Date: Sat, 3 Sep 2022 16:53:16 -0400 Subject: [PATCH] wokring reference version --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++--- Makefile | 4 ++++ deps.edn | 4 ++-- src/libpython_test/test.clj | 12 +++++------ 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile index c4083dc..08d7f26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,37 @@ -FROM clojure:openjdk-17-tools-deps +# We will use Ubuntu for our image +FROM ubuntu:latest + +# Updating Ubuntu packages + +ARG CLOJURE_TOOLS_VERSION=1.10.1.507 + +RUN apt-get -qq update \ + && apt install -y software-properties-common \ + && add-apt-repository -y ppa:deadsnakes/ppa + +RUN apt-get -qq update && apt-get -qq -y install curl wget bzip2 openjdk-8-jdk-headless python3.9 libpython3.9 python3-pip python3-distutils rlwrap\ + && curl -o install-clojure https://download.clojure.org/install/linux-install-${CLOJURE_TOOLS_VERSION}.sh \ + && chmod +x install-clojure \ + && ./install-clojure && rm install-clojure \ + && wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein \ + && chmod a+x lein \ + && mv lein /usr/bin \ + && apt-get -qq -y autoremove \ + && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log + + +# ARG USERID +# ARG GROUPID +# ARG USERNAME + +# RUN groupadd -g $GROUPID $USERNAME +# RUN useradd -u $USERID -g $GROUPID $USERNAME +# RUN mkdir /home/$USERNAME && chown $USERNAME:$USERNAME /home/$USERNAME +# USER $USERNAME + +# Install leiningen during build process +RUN lein -v EXPOSE 9876 @@ -20,10 +53,13 @@ WORKDIR /app COPY . . # Make sure deps are pre-installed -RUN clojure -e "(clojure.core/println :deps-downloaded)" +RUN clojure -e "(clojure.core/println :deps-downloaded)" || clojure -e "(clojure.core/println :deps-downloaded)" || clojure -e "(clojure.core/println :deps-downloaded)" || clojure -e "(clojure.core/println :deps-downloaded)" || clojure -e "(clojure.core/println :deps-downloaded)" # Systems go -CMD clojure -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" --port 9876 + +# CMD clojure -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" --port 9876 + +CMD make run diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9243352 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +run: + clj -m libpython-test.test + +FORCE: diff --git a/deps.edn b/deps.edn index 9364a6b..0566e00 100644 --- a/deps.edn +++ b/deps.edn @@ -8,5 +8,5 @@ cider/cider-nrepl {:mvn/version "0.28.5"} com.taoensso/timbre {:mvn/version "5.2.1"} ch.qos.logback/logback-classic {:mvn/version "1.1.3"}} - ;; Required for jvm > 16 - :jvm-opts ["--add-modules" "jdk.incubator.foreign" "--enable-native-access=ALL-UNNAMED"]} + :aliases {:opts {:jvm-opts ["--add-modules" "jdk.incubator.foreign" + "--enable-native-access=ALL-UNNAMED"]}}} diff --git a/src/libpython_test/test.clj b/src/libpython_test/test.clj index 4ee5093..4dadc81 100644 --- a/src/libpython_test/test.clj +++ b/src/libpython_test/test.clj @@ -1,9 +1,9 @@ (ns libpython-test.test (:require [libpython-clj2.python :as py])) -(py/initialize!) - -;(require '[libpython-clj2.require :as py-req]) -;(require 'libpython-clj2.metadata) - -(println :OK) +(defn -main [] + (py/initialize!) + (require '[libpython-clj2.require :as py-req]) + (require 'libpython-clj2.metadata) + (println :OK) + (shutdown-agents))