diff --git a/.gitignore b/.gitignore new file mode 100644 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +docker/config.lisp diff --git a/Dockerfile b/Dockerfile new file mode 100644 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM debian:11 +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && apt-get upgrade -y && \ + apt-get install -y \ + cl-quicklisp \ + default-libmysqlclient-dev \ + git + +RUN mkdir -p /srv/phabricator /opt/forgerie +RUN useradd -md /srv/forgerie -s /bin/bash forgerie +COPY docker/.sbclrc /srv/forgerie/.sbclrc +RUN chown -R forgerie:forgerie /srv/forgerie /opt/forgerie + +USER forgerie +WORKDIR /srv/forgerie + +# install quicklisp and pulls core dependencies for it to run properly +RUN sbcl --no-sysinit --no-userinit --noprint \ + --load /usr/share/common-lisp/source/quicklisp/quicklisp.lisp \ + --eval '(quicklisp-quickstart:install :path "quicklisp")' \ + --quit # to install and configure quicklisp + +COPY . /opt/forgerie +ENV FORGERIE_PATH=/opt/forgerie/ + +# install quicklisp and pulls core dependencies for it to run properly +RUN sbcl --quit diff --git a/docker/.sbclrc b/docker/.sbclrc new file mode 100644 --- /dev/null +++ b/docker/.sbclrc @@ -0,0 +1,12 @@ +(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) + +;; Make sure we can provide path to forgerie code... +(let ((forgerie-path (uiop:getenv "FORGERIE_PATH"))) + (when (and forgerie-path (probe-file forgerie-path)) + (push (pathname forgerie-path) asdf:*central-registry*))) + +;; so quicklisp is able to run the forgerie code and execute the script +(ql:quickload :forgerie) diff --git a/docker/README.md b/docker/README.md new file mode 100644 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,19 @@ +# Build + +``` +$ name=forgerie +$ docker build -t $name . +``` + +# Run script(s) + +Edit /docker/config.lisp according to your runtime requirements, then run: +``` +$ docker run -it $name \ + -v /path/to/clone/forgerie/docker:/opt/forgerie/config \ + $script +``` + +for script in /opt/forgerie/bin/{build-config-tmpl, run, postmortem} + +