Skip to content

Commit

Permalink
Merge pull request #4212 from avalonmediasystem/staging
Browse files Browse the repository at this point in the history
7.1.1 release
  • Loading branch information
Jon Cameron authored Jul 14, 2020
2 parents 9a7bb05 + fd8a456 commit 94d7b9a
Show file tree
Hide file tree
Showing 101 changed files with 1,433 additions and 545 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
build:
docker:
# Primary container image where all steps run.
- image: avalonmediasystem/avalon:7.0-slim-dev-20200225
- image: avalonmediasystem/avalon:7.1-slim-dev-20200324
environment:
- DATABASE_URL=postgresql://postgres@localhost:5432/postgres
- FEDORA_URL=http://localhost:8080/fcrepo/rest
Expand Down
7 changes: 5 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.bundle
.git
.DS_Store
.gitignore
.env
tmp
Dockerfile
docker-compose.yml
docker-compose.yml
node_modules
public/packs
tmp
101 changes: 72 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
# Base stage for building gems
FROM ruby:2.5.5-stretch as base
ENV BUNDLER_VERSION 2.0.2
FROM ruby:2.5.5-stretch as bundle
RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list \
&& apt-get update && apt-get upgrade -y build-essential \
&& apt-get install -y --no-install-recommends \
cmake \
pkg-config \
zip \
git \
&& gem install bundler \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

RUN mkdir -p /home/app/avalon
WORKDIR /home/app/avalon

COPY Gemfile ./Gemfile
COPY Gemfile.lock ./Gemfile.lock
RUN bundle config build.nokogiri --use-system-libraries \
&& bundle install --with aws development test postgres --without production

RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" \
&& bundle config build.nokogiri --use-system-libraries


# Build development gems
FROM bundle as bundle-dev
RUN bundle install --with aws development test postgres --without production

# Download stage takes advantage of parallel build

# Download binaries in parallel
FROM ruby:2.5.5-stretch as download
RUN curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz | tar xvz -C /usr/bin/
RUN curl https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip -o /usr/local/bin/chromedriver \
&& chmod +x /usr/local/bin/chromedriver \
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz | tar xvz -C /usr/bin/ \
&& mkdir -p /tmp/ffmpeg && cd /tmp/ffmpeg \
&& chmod +x /usr/local/bin/chromedriver
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN mkdir -p /tmp/ffmpeg && cd /tmp/ffmpeg \
&& curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | tar xJ \
&& cp `find . -type f -executable` /usr/bin/


# Dev stage for building dev image
FROM ruby:2.5.5-slim-stretch as dev
ENV BUNDLER_VERSION 2.0.2
# Base stage for building final images
FROM ruby:2.5.5-slim-stretch as base
RUN apt-get update && apt-get install -y --no-install-recommends curl gnupg2 \
&& curl -sL http://deb.nodesource.com/setup_8.x | bash - \
&& curl -O https://mediaarea.net/repo/deb/repo-mediaarea_1.0-6_all.deb && dpkg -i repo-mediaarea_1.0-6_all.deb \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt-get update && apt-get install -y --no-install-recommends --allow-unauthenticated \
yarn \
nodejs \
lsof \
Expand All @@ -53,23 +54,65 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
mediainfo \
openssh-client \
zip \
imagemagick \
dumb-init \
&& gem install bundler \
&& curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb \
&& dpkg -i /chrome.deb || apt-get install -yf \
&& ln -s /usr/bin/lsof /usr/sbin/

ARG AVALON_BRANCH=develop
ARG RAILS_ENV=development
ARG BASE_URL
ARG DATABASE_URL
ARG SECRET_KEY_BASE

COPY --from=base /usr/local/bundle /usr/local/bundle
COPY --from=download /usr/local/bin/chromedriver /usr/local/bin/chromedriver
RUN useradd -m -U app \
&& su -s /bin/bash -c "mkdir -p /home/app/avalon" app
WORKDIR /home/app/avalon

COPY --from=download /usr/bin/ff* /usr/bin/
COPY --from=download /usr/bin/dockerize /usr/bin/

WORKDIR /home/app/avalon


# Build devevelopment image
FROM base as dev
RUN apt-get install -y --no-install-recommends --allow-unauthenticated \
build-essential \
cmake

COPY --from=bundle-dev /usr/local/bundle /usr/local/bundle
COPY --from=download /chrome.deb /
COPY --from=download /usr/local/bin/chromedriver /usr/local/bin/chromedriver
COPY --from=download /usr/bin/dockerize /usr/bin/
ADD docker_init.sh /

ARG RAILS_ENV=development
RUN dpkg -i /chrome.deb || apt-get install -yf


# Build production gems
FROM bundle as bundle-prod
RUN bundle install --without development test --with aws production postgres


# Install node modules
FROM node:8.17.0-stretch-slim as node-modules
RUN apt-get update && apt-get install -y --no-install-recommends git
COPY package.json .
COPY yarn.lock .
RUN yarn install


# Build production assets
FROM base as assets
COPY --from=bundle-prod --chown=app:app /usr/local/bundle /usr/local/bundle
COPY --chown=app:app . .
COPY --from=node-modules --chown=app:app /node_modules ./node_modules

USER app
ENV RAILS_ENV=production

RUN SECRET_KEY_BASE=$(ruby -r 'securerandom' -e 'puts SecureRandom.hex(64)') bundle exec rake webpacker:compile
RUN SECRET_KEY_BASE=$(ruby -r 'securerandom' -e 'puts SecureRandom.hex(64)') bundle exec rake assets:precompile
RUN cp config/controlled_vocabulary.yml.example config/controlled_vocabulary.yml


# Build production image
FROM base as prod
COPY --from=assets --chown=app:app /home/app/avalon /home/app/avalon
COPY --from=bundle-prod --chown=app:app /usr/local/bundle /usr/local/bundle

USER app
ENV RAILS_ENV=production
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
# Core rails
gem 'bootsnap', require: false
gem 'listen'
gem 'rails', '=5.2.3'
gem 'rails', '=5.2.4.3'
gem 'sprockets', '~>3.7.2'
gem 'sqlite3'

Expand Down Expand Up @@ -44,6 +44,7 @@ gem 'bootstrap-toggle-rails'
gem 'bootstrap_form'
gem 'iiif_manifest', '~> 0.6'
gem 'rack-cors', require: 'rack/cors'
gem 'rails_same_site_cookie'
gem 'recaptcha', require: 'recaptcha/rails'
gem 'samvera-persona', '~> 0.1.7'
gem 'speedy-af', '~> 0.1.3'
Expand All @@ -61,7 +62,7 @@ gem 'omniauth-lti', git: "https://github.com/avalonmediasystem/omniauth-lti.git"

# Media Access & Transcoding
gem 'active_encode', '~> 0.7.0'
gem 'audio_waveform-ruby', require: 'audio_waveform'
gem 'audio_waveform-ruby', '~> 1.0.7', require: 'audio_waveform'
gem 'browse-everything', '~> 0.13.0'
gem 'fastimage'
gem 'media_element_add_to_playlist', git: 'https://github.com/avalonmediasystem/media-element-add-to-playlist.git', tag: 'avalon-r6.5'
Expand Down Expand Up @@ -146,6 +147,7 @@ end
group :production do
gem 'google-analytics-rails', '1.1.0'
gem 'lograge'
gem 'puma'
end

# Install the bundle --with aws when running on Amazon Elastic Beanstalk
Expand Down
Loading

0 comments on commit 94d7b9a

Please sign in to comment.