2017-04-12 13:58:26 +00:00
|
|
|
FROM ubuntu:16.04
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-12 13:58:26 +00:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
ARG NODE_VERSION=node_6.x
|
|
|
|
ARG DISTRO=xenial
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y wget software-properties-common apt-transport-https && \
|
|
|
|
add-apt-repository ppa:brightbox/ruby-ng && \
|
|
|
|
echo "deb https://deb.nodesource.com/$NODE_VERSION $DISTRO main" >/etc/apt/sources.list.d/nodesource.list && \
|
2017-05-12 16:52:42 +00:00
|
|
|
echo "deb https://packages.erlang-solutions.com/ubuntu $DISTRO contrib" >/etc/apt/sources.list.d/esl.list && \
|
2017-04-12 13:58:26 +00:00
|
|
|
wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
|
2017-05-12 16:52:42 +00:00
|
|
|
wget --quiet -O - https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | apt-key add - && \
|
2015-10-27 11:39:35 +00:00
|
|
|
apt-get update && \
|
|
|
|
apt-get install -y \
|
|
|
|
build-essential \
|
2017-05-12 16:52:42 +00:00
|
|
|
elixir \
|
|
|
|
esl-erlang \
|
2015-10-27 11:39:35 +00:00
|
|
|
git-core \
|
2017-04-12 13:58:26 +00:00
|
|
|
libfontconfig1 \
|
2015-10-27 11:39:35 +00:00
|
|
|
libpq-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt1-dev \
|
2017-04-13 11:03:51 +00:00
|
|
|
nginx \
|
2017-04-12 13:58:26 +00:00
|
|
|
nodejs \
|
|
|
|
ruby2.1 \
|
|
|
|
ruby2.1-dev \
|
2017-04-13 11:03:51 +00:00
|
|
|
supervisor \
|
2017-04-14 07:10:17 +00:00
|
|
|
ttf-bitstream-vera \
|
|
|
|
tzdata
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-13 17:37:02 +00:00
|
|
|
# Packages required for:
|
|
|
|
# libfontconfig1 for PhantomJS
|
|
|
|
# ttf-bitstream-vera for a2png
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
# install Bundler and SASS
|
2017-04-13 09:27:10 +00:00
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
RUN gem install bundler sass
|
|
|
|
|
|
|
|
# install Hex and Rebar
|
|
|
|
|
|
|
|
ENV LANG=C.UTF-8
|
|
|
|
|
|
|
|
RUN mix local.hex --force && mix local.rebar --force
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-13 09:27:10 +00:00
|
|
|
# install PhantomJS
|
|
|
|
|
2017-04-12 13:58:26 +00:00
|
|
|
ARG PHANTOMJS_VERSION=2.1.1
|
|
|
|
|
|
|
|
RUN wget --quiet -O /opt/phantomjs.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \
|
|
|
|
tar xjf /opt/phantomjs.tar.bz2 -C /opt && \
|
|
|
|
rm /opt/phantomjs.tar.bz2 && \
|
|
|
|
ln -sf /opt/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin/phantomjs /usr/local/bin
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-13 09:26:22 +00:00
|
|
|
# install JDK
|
|
|
|
|
2017-06-01 10:28:00 +00:00
|
|
|
RUN wget --quiet -O /opt/jdk-8u131-linux-x64.tar.gz --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz && \
|
|
|
|
tar xzf /opt/jdk-8u131-linux-x64.tar.gz -C /opt && \
|
|
|
|
rm /opt/jdk-8u131-linux-x64.tar.gz && \
|
|
|
|
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_131/bin/java 1000
|
2017-04-13 09:26:22 +00:00
|
|
|
|
|
|
|
# install leiningen
|
|
|
|
|
|
|
|
RUN wget --quiet -O /usr/local/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein && \
|
|
|
|
chmod a+x /usr/local/bin/lein
|
|
|
|
|
|
|
|
ARG LEIN_ROOT=yes
|
|
|
|
|
2015-10-27 11:39:35 +00:00
|
|
|
# install asciinema
|
2017-04-13 09:26:22 +00:00
|
|
|
|
2017-04-13 12:37:40 +00:00
|
|
|
ENV RAILS_ENV "production"
|
2017-05-12 16:52:42 +00:00
|
|
|
ENV MIX_ENV "prod"
|
2017-04-13 12:37:40 +00:00
|
|
|
|
2017-04-13 09:26:22 +00:00
|
|
|
RUN mkdir -p /app/tmp /app/log
|
2015-10-27 11:39:35 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
# install gems
|
|
|
|
|
2017-04-13 18:22:47 +00:00
|
|
|
COPY Gemfile* /app/
|
2017-04-24 10:45:07 +00:00
|
|
|
RUN bundle install --deployment --without development test --jobs 10 --retry 5
|
2017-04-12 19:43:32 +00:00
|
|
|
|
2017-04-14 22:25:21 +00:00
|
|
|
# build a2png
|
|
|
|
|
2017-04-13 16:10:23 +00:00
|
|
|
COPY a2png/project.clj /app/a2png/
|
2017-04-13 09:26:22 +00:00
|
|
|
RUN cd a2png && lein deps
|
|
|
|
|
2017-04-14 22:25:21 +00:00
|
|
|
COPY a2png/package.json /app/a2png/
|
|
|
|
RUN cd a2png && npm install
|
|
|
|
|
2017-04-13 16:10:23 +00:00
|
|
|
COPY a2png /app/a2png
|
|
|
|
RUN cd a2png && lein cljsbuild once main && lein cljsbuild once page
|
|
|
|
|
2017-06-06 10:01:49 +00:00
|
|
|
# build vt
|
|
|
|
|
|
|
|
COPY vt/project.clj /app/vt/
|
|
|
|
RUN cd vt && lein deps
|
|
|
|
|
|
|
|
COPY vt /app/vt
|
|
|
|
RUN cd vt && lein cljsbuild once main
|
|
|
|
|
2017-05-27 19:26:25 +00:00
|
|
|
# service URLs
|
2017-04-12 19:43:32 +00:00
|
|
|
|
2017-05-12 16:36:17 +00:00
|
|
|
ENV DATABASE_URL "postgresql://postgres@postgres/postgres"
|
2017-04-13 16:12:45 +00:00
|
|
|
ENV REDIS_URL "redis://redis:6379"
|
|
|
|
|
2017-05-27 19:26:25 +00:00
|
|
|
# add Ruby source files
|
|
|
|
|
|
|
|
COPY config/*.rb /app/config/
|
|
|
|
COPY config/*.yml /app/config/
|
|
|
|
COPY config/environments /app/config/environments
|
|
|
|
COPY config/initializers /app/config/initializers
|
|
|
|
COPY config/locales /app/config/locales
|
|
|
|
COPY db /app/db
|
|
|
|
COPY lib/*.rb /app/lib/
|
|
|
|
COPY lib/authentication /app/lib/authentication
|
|
|
|
COPY lib/tasks /app/lib/tasks
|
|
|
|
COPY public /app/public
|
|
|
|
COPY vendor /app/vendor
|
|
|
|
COPY config.ru /app/
|
|
|
|
COPY Rakefile /app/
|
|
|
|
COPY app /app/app
|
2017-06-06 10:01:49 +00:00
|
|
|
COPY resources/welcome.json /app/resources/welcome.json
|
2017-05-27 19:26:25 +00:00
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
# compile assets with assets pipeline
|
2017-04-14 22:30:18 +00:00
|
|
|
|
2017-04-13 12:37:40 +00:00
|
|
|
RUN bundle exec rake assets:precompile
|
2017-04-14 22:30:18 +00:00
|
|
|
|
2017-05-27 19:26:25 +00:00
|
|
|
# install hex packages
|
|
|
|
|
|
|
|
COPY mix.* /app/
|
|
|
|
RUN mix deps.get --only prod
|
|
|
|
|
|
|
|
# install brunch & co
|
|
|
|
|
|
|
|
COPY package.json /app/
|
|
|
|
RUN npm install
|
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
# compile assets with brunch and generate digest file
|
|
|
|
|
2017-05-27 19:26:25 +00:00
|
|
|
COPY brunch-config.js /app/
|
|
|
|
COPY web/static /app/web/static
|
2017-05-12 16:52:42 +00:00
|
|
|
RUN node_modules/brunch/bin/brunch build --production && mix phoenix.digest
|
|
|
|
|
2017-05-27 19:26:25 +00:00
|
|
|
# add Elixir source files
|
|
|
|
|
|
|
|
COPY config/*.exs /app/config/
|
|
|
|
COPY lib/*.ex /app/lib
|
|
|
|
COPY lib/asciinema /app/lib/asciinema
|
|
|
|
COPY priv/gettext /app/priv/gettext
|
|
|
|
COPY priv/repo /app/priv/repo
|
|
|
|
COPY web /app/web
|
|
|
|
|
2017-05-12 16:52:42 +00:00
|
|
|
# compile Elixir app
|
|
|
|
|
|
|
|
RUN mix compile
|
|
|
|
|
2017-04-14 22:30:18 +00:00
|
|
|
# install smtp configuration
|
|
|
|
|
2017-04-13 20:19:39 +00:00
|
|
|
COPY docker/asciinema.yml /app/config/asciinema.yml
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-13 11:03:51 +00:00
|
|
|
# configure Nginx
|
|
|
|
|
|
|
|
COPY docker/nginx/asciinema.conf /etc/nginx/sites-available/default
|
|
|
|
|
|
|
|
# configure Supervisor
|
|
|
|
|
|
|
|
RUN mkdir -p /var/log/supervisor
|
|
|
|
COPY docker/supervisor/asciinema.conf /etc/supervisor/conf.d/asciinema.conf
|
|
|
|
|
2017-04-18 22:00:31 +00:00
|
|
|
# add start script for Clojure app
|
|
|
|
|
2017-05-02 14:58:02 +00:00
|
|
|
ENV A2PNG_BIN_PATH "/app/a2png/a2png.sh"
|
2017-04-18 22:00:31 +00:00
|
|
|
|
2017-05-30 18:02:07 +00:00
|
|
|
VOLUME ["/app/log", "/app/uploads", "/cache"]
|
2015-10-27 11:39:35 +00:00
|
|
|
|
2017-04-13 11:03:51 +00:00
|
|
|
CMD ["/usr/bin/supervisord"]
|
|
|
|
|
|
|
|
EXPOSE 80
|
2017-05-02 15:04:27 +00:00
|
|
|
EXPOSE 3000
|
|
|
|
EXPOSE 4000
|