Skip to content

Commit

Permalink
Merge pull request #281 from billbsing/rebuild-docker
Browse files Browse the repository at this point in the history
new docker file
  • Loading branch information
mikera authored Apr 16, 2024
2 parents cd000d3 + c31700d commit 28c42cf
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2,577 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/.git
**/node_modules
*.gz
convex-*.jar
49 changes: 40 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
# Docker for convex web

FROM node:latest
# base docker on latest node but install java 17
# currently this is the only working solution for arm64 builds.
# FROM node:latest

# we can base the docker image on java 23, but install node
FROM openjdk:23-bookworm

ENV HOME=/home/convex-web

ENV CLOJURE_VER=1.10.3.933

RUN apt-get update \
&& apt-get -q -y install openjdk-11-jdk curl \
&& npm install -g shadow-cljs \
&& curl -s https://download.clojure.org/install/linux-install-$CLOJURE_VER.sh | bash
RUN apt-get update

# install the standard java 17 from the node:latest build
# RUN apt-cache search jdk
# RUN apt-get install -y curl openjdk-17-jdk


# install node 18.x if we are using the java base docker image
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash
RUN apt-get install -y nodejs
RUN curl -L https://www.npmjs.com/install.sh | sh

# for arm64 only
RUN apt-get install -y liblmdb-dev

# install latest clojure
RUN curl -L -O https://github.com/clojure/brew-install/releases/latest/download/posix-install.sh
RUN chmod +x posix-install.sh
RUN ./posix-install.sh


WORKDIR $HOME

ADD . $HOME

RUN npm install
# remove old jar files
RUN rm -f $HOME/*.jar

RUN npm install
RUN npm run app:release

RUN npm run styles:release

# setup key file storage and access details
# for security this needs to be moved late to an external mount point
RUN rm -rf $HOME/.convex
RUN mkdir -p $HOME/.convex
RUN echo "{:key-store-passphrase \"password\" \
Expand All @@ -29,4 +52,12 @@ ADD config.edn $HOME/.convex/config.edn
RUN rm $HOME/config.edn
RUN ln -s $HOME/.convex/config.edn $HOME/config.edn

CMD clojure -J-Duser.home=$HOME -M:main:repl:logback-prod -e "(go)"

# startup the web and peer services
CMD clojure \
-J--add-opens=java.base/java.nio=ALL-UNNAMED \
-J--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED \
-J--add-opens=java.base/sun.nio.ch=ALL-UNNAMED \
-J-Duser.home=$HOME \
-M:main:repl:logback-dev \
-e "(go)"
Loading

0 comments on commit 28c42cf

Please sign in to comment.