Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working reference version #2

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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


4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
run:
clj -m libpython-test.test

FORCE:
4 changes: 2 additions & 2 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}}}
12 changes: 6 additions & 6 deletions src/libpython_test/test.clj
Original file line number Diff line number Diff line change
@@ -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 []
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this necessary to get things working? You'll see in clj-python/libpython-clj#213 that moving requirement of libpython-clj2.require conflicts a bit with what I'm trying to accomplish.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, not necessary, just for testing purposes so that clj -m libpython-test.test would run and print :OK and then exit gracefully. Was just to verify that libpython-clj would load correctly.

(py/initialize!)
(require '[libpython-clj2.require :as py-req])
(require 'libpython-clj2.metadata)
(println :OK)
(shutdown-agents))