-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #752 from LafayetteCollegeLibraries/develop
2021.6
- Loading branch information
Showing
112 changed files
with
5,440 additions
and
1,473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
.git | ||
/log/* | ||
# start by ignoring everything | ||
* | ||
|
||
# allow app directories that we need | ||
!/app | ||
!/bin | ||
!/config | ||
!/db | ||
!/derivatives/.keep | ||
!/ingest/.keep | ||
!/lib | ||
!/log/.keep | ||
/tmp/* | ||
!/public | ||
!/tmp/.keep | ||
/spec/* | ||
/coverage | ||
.byebug_history | ||
fits.log | ||
node_modules | ||
!/vendor/.keep | ||
|
||
# allow files @ app root | ||
!config.ru | ||
!Gemfile | ||
!Gemfile.lock | ||
!package.json | ||
!Rakefile | ||
!yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,81 @@ | ||
# base image | ||
FROM ruby:2.4.3 as spot-base | ||
|
||
# add node + yarn repositories (do we need both?) | ||
RUN apt-get update && apt-get install -y -qq apt-transport-https apt-utils \ | ||
&& (curl -sL https://deb.nodesource.com/setup_10.x | bash) \ | ||
&& (curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -) \ | ||
&& (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -) \ | ||
&& (echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list) | ||
|
||
# add ghostscript, ImageMagick, and libreoffice to the jobs service only | ||
RUN apt-get update && apt-get install -y \ | ||
yarn \ | ||
nodejs \ | ||
netcat \ | ||
ghostscript \ | ||
ImageMagick \ | ||
libreoffice | ||
|
||
RUN gem update bundler | ||
ARG RUBY_VERSION=2.4.3-alpine3.6 | ||
FROM ruby:$RUBY_VERSION as spot-base | ||
|
||
# system dependencies | ||
# TODO: imagemagick might belong in the worker container instead? | ||
RUN apk --no-cache upgrade && \ | ||
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/main/ nodejs=8.9.3-r1 && \ | ||
apk --no-cache add \ | ||
build-base \ | ||
coreutils \ | ||
curl \ | ||
ruby-dev \ | ||
imagemagick \ | ||
tzdata \ | ||
netcat-openbsd \ | ||
yarn \ | ||
zip \ | ||
postgresql postgresql-dev \ | ||
git \ | ||
openssl | ||
|
||
# let's not run this as root | ||
# (taken from hyrax's Dockerfile) | ||
# RUN addgroup -S -g 101 app && \ | ||
# adduser -S -G app -u 1001 -s /bin/sh -h /app app | ||
# RUN mkdir /spot && chown -R 1001:101 /spot | ||
# USER app | ||
|
||
WORKDIR /spot | ||
|
||
# match our Gemfile.lock version | ||
# TODO: upgrade the Gemfile bundler version to 2 | ||
RUN gem install bundler:1.13.7 | ||
|
||
# install dependencies | ||
# --- | ||
# get installation files copied over first, run installations, _then_ copy | ||
# the application files over, so that we can rely on docker's cache first | ||
# when rebuilding. | ||
# | ||
# a) bundle + yarn files | ||
COPY ["Gemfile", "Gemfile.lock", "package.json", "yarn.lock", "/spot/"] | ||
# COPY --chown=1001:101 ["Gemfile", "Gemfile.lock", "package.json", "yarn.lock", "/spot"] | ||
COPY ["Gemfile", "Gemfile.lock", "package.json", "yarn.lock", "/spot"] | ||
|
||
# b) uv configuration files (yarn will copy files to public as part of the installation process) | ||
RUN mkdir config | ||
COPY config/uv config/uv | ||
# b) make directories for installation configuration (`config/`, `public/`, and `vendor/`) | ||
# and those for derivatives + uploads | ||
RUN mkdir -p /spot/config /spot/public /spot/vendor && \ | ||
mkdir -p /spot/derivatives /spot/uploads | ||
|
||
# install dependencies | ||
RUN bundle install --jobs "$(nproc)" && yarn install | ||
# c) install dependencies | ||
ARG BUNDLE_WITHOUT="development test" | ||
RUN bundle install --jobs "$(nproc)" --path "/spot/vendor" | ||
|
||
# finally, copy our current work files to the image | ||
# d) copy the application files | ||
# COPY --chown=1001:101 . /spot | ||
COPY . /spot | ||
|
||
VOLUME ["/spot/public", "/spot/tmp"] | ||
ENTRYPOINT ["/spot/bin/spot-entrypoint.sh"] | ||
CMD ["bundle", "exec", "rails", "server", "-b", "tcp://0.0.0.0:3000"] | ||
|
||
FROM spot-base as spot-app | ||
COPY config/uv config/uv | ||
|
||
RUN yarn install | ||
CMD ["bundle", "exec", "rails", "server", "-u", "puma", "-b", "ssl://0.0.0.0:443?key=/trustee_minutes/tmp/ssl/application.key&cert=/trustee_minutes/tmp/ssl/application.crt"] | ||
|
||
# precompile assets | ||
# RUN DATABASE_URL="postgres://fake" SECRET_KEY_BASE="secret-shh" bundle exec rake assets:precompile | ||
|
||
FROM spot-base as spot-worker | ||
# USER root | ||
RUN apk --no-cache upgrade && \ | ||
apk --no-cache add \ | ||
imagemagick \ | ||
ghostscript | ||
|
||
ENTRYPOINT ["bin/spot-entrypoint.sh"] | ||
CMD ["bundle", "exec", "puma", "-v", "-b", "tcp://0.0.0.0:3000"] | ||
# USER app | ||
ARG BUNDLE_WITHOUT="" | ||
RUN bundle install --jobs "$(nproc)" --path "/spot/vendor" | ||
CMD ["bundle", "exec", "sidekiq"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.