Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

adding Dockerfile#258

Open
jdolitsky wants to merge 1 commit into4clojure:developfrom
jdolitsky:develop
Open

adding Dockerfile#258
jdolitsky wants to merge 1 commit into4clojure:developfrom
jdolitsky:develop

Conversation

@jdolitsky
Copy link

For Docker-based development/deployment. Merge if you wish!

@webcoyote
Copy link

Thanks for writing this! I had to change the top part of the file a little to get things to work:

  1. added example code to manually build dockerfile/ubuntu to avoid login prompt
  2. added code to install software-properties-common, which is required for add-apt-repository
  3. update to java9 since java7 download returns 404
#
# To use:
#
#   $ docker build -t="dockerfile/ubuntu" github.com/dockerfile/ubuntu
#   $ docker build -t 4clojure .
#   $ docker run -d -p 3000:80 4clojure
#
# server accessible at localhost:3000
#

# Pull base image.
FROM dockerfile/ubuntu

# Prepare to run add-apt-repository
RUN \
  apt-get update && \
  apt-get install software-properties-common
  
# Install Java.
RUN \
  echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
  echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections && \
  add-apt-repository -y ppa:webupd8team/java && \
  apt-get update && \
  apt-get install -y oracle-java9-installer


#### <<< everything is the same from here down>>>


# Install Leiningen.
RUN curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > \
    /usr/local/bin/lein && \
    chmod 0755 /usr/local/bin/lein

# Install MongoDB.
RUN \
  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
  echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list && \
  apt-get update && \
  apt-get install -y mongodb-org && \
  mkdir -p /data/db

# Install Supervisor.
RUN \
  apt-get install -y supervisor && \
  sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisor/supervisord.conf

# Setup 4clojure.
RUN echo 'grant { permission java.security.AllPermission; };' > ~/.java.policy
RUN git clone https://github.com/4clojure/4clojure.git /opt/4clojure
WORKDIR /opt/4clojure
ENV LEIN_ROOT 1
RUN lein deps
RUN mongod & ./load-data.sh
RUN echo '#!/bin/bash\ncd $(dirname $0) && lein ring server-headless 80' > start && chmod +x start

# Define working directory.
WORKDIR /etc/supervisor/conf.d

# Add Supervisor confs for MongoDB and 4clojure.
RUN echo '[program:mongodb]\ncommand=mongod\nautostart=true\nautorestart=true\n' > mongodb.conf
RUN echo '[program:4clojure]\ncommand=/opt/4clojure/start\nautostart=true\nautorestart=true\n' > 4clojure.conf

# Expose ring server port.
EXPOSE 80

# Define default command.
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants