-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jason Fine
committed
Aug 12, 2022
1 parent
985761e
commit 47eca27
Showing
12 changed files
with
339 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,95 @@ | ||
FROM ruby:3.1.1 | ||
# syntax = docker/dockerfile:experimental | ||
ARG RUBY_VERSION=3.1.1 | ||
ARG VARIANT=jemalloc-slim | ||
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base | ||
|
||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
RUN apt-get update -y | ||
RUN apt-get install -y \ | ||
libqt5webkit5-dev \ | ||
build-essential \ | ||
qtbase5-dev \ | ||
qtchooser \ | ||
qt5-qmake \ | ||
qtbase5-dev-tools \ | ||
xvfb | ||
ARG NODE_VERSION=16 | ||
ARG BUNDLER_VERSION=2.3.9 | ||
|
||
ENV app /app | ||
ENV BUNDLE_PATH /gems | ||
ENV GEM_HOME /gems | ||
ARG RAILS_ENV=production | ||
ENV RAILS_ENV=${RAILS_ENV} | ||
|
||
COPY Gemfile* $app/ | ||
ENV RAILS_SERVE_STATIC_FILES true | ||
ENV RAILS_LOG_TO_STDOUT true | ||
|
||
ENV PATH="$PATH:$BUNDLE_PATH/bin" | ||
ARG BUNDLE_WITHOUT=development:test | ||
ARG BUNDLE_PATH=vendor/bundle | ||
ENV BUNDLE_PATH ${BUNDLE_PATH} | ||
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} | ||
|
||
COPY . $app/ | ||
RUN mkdir -p /app/spec/dummy/tmp/pids | ||
WORKDIR /app | ||
# RUN touch tmp/pids/.keep | ||
RUN touch /app/spec/dummy/tmp/pids/server.pid | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN curl https://get.volta.sh | bash | ||
|
||
ENV BASH_ENV ~/.bashrc | ||
ENV VOLTA_HOME /root/.volta | ||
ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH | ||
|
||
RUN volta install node@${NODE_VERSION} && volta install yarn | ||
|
||
FROM base as build_deps | ||
|
||
ARG DEV_PACKAGES="git build-essential libpq-dev wget vim curl gzip xz-utils libsqlite3-dev imagemagick libmagickcore-dev libmagickwand-dev" | ||
ENV DEV_PACKAGES ${DEV_PACKAGES} | ||
|
||
RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ | ||
--mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ | ||
apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y ${DEV_PACKAGES} \ | ||
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
FROM build_deps as gems | ||
|
||
RUN gem install -N bundler -v ${BUNDLER_VERSION} | ||
|
||
COPY Gemfile* ./ | ||
COPY fae.gemspec* ./ | ||
RUN bundle install && rm -rf vendor/bundle/ruby/*/cache | ||
|
||
FROM build_deps as node_modules | ||
|
||
COPY package*json ./ | ||
COPY yarn.* ./ | ||
|
||
RUN if [ -f "yarn.lock" ]; then \ | ||
yarn install; \ | ||
elif [ -f "package-lock.json" ]; then \ | ||
npm install; \ | ||
else \ | ||
mkdir node_modules; \ | ||
fi | ||
|
||
FROM base | ||
|
||
ARG PROD_PACKAGES="postgresql-client file vim curl gzip libsqlite3-0 imagemagick libmagickcore-dev libmagickwand-dev" | ||
ENV PROD_PACKAGES=${PROD_PACKAGES} | ||
|
||
RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt \ | ||
--mount=type=cache,id=prod-apt-lib,sharing=locked,target=/var/lib/apt \ | ||
apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y \ | ||
${PROD_PACKAGES} \ | ||
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
||
COPY --from=gems /app /app | ||
COPY --from=node_modules /app/node_modules /app/node_modules | ||
|
||
ENV SECRET_KEY_BASE 1 | ||
|
||
COPY . . | ||
|
||
WORKDIR /app/spec/dummy | ||
|
||
RUN bundle exec rails assets:precompile | ||
# RUN cd spec/dummy && bundle exec rails assets:precompile | ||
|
||
ENV PORT 8080 | ||
|
||
ARG SERVER_COMMAND="bundle exec puma -C config/puma.rb" | ||
ENV SERVER_COMMAND ${SERVER_COMMAND} | ||
CMD ${SERVER_COMMAND} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ruby:3.1.1 | ||
|
||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||
RUN apt-get update -y | ||
RUN apt-get install -y \ | ||
libqt5webkit5-dev \ | ||
build-essential \ | ||
qtbase5-dev \ | ||
qtchooser \ | ||
qt5-qmake \ | ||
qtbase5-dev-tools \ | ||
xvfb | ||
|
||
ENV app /app | ||
ENV BUNDLE_PATH /gems | ||
ENV GEM_HOME /gems | ||
|
||
COPY Gemfile* $app/ | ||
|
||
ENV PATH="$PATH:$BUNDLE_PATH/bin" | ||
|
||
COPY . $app/ |
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,3 +1,42 @@ | ||
CarrierWave.configure do |config| | ||
config.cache_dir = "#{Rails.root}/tmp/fae/uploads" | ||
CarrierWave.configure do |config| | ||
config.cache_dir = "#{Rails.root}/tmp/fae/uploads" | ||
|
||
if Rails.env.production? || Rails.env.remote_development? | ||
config.fog_provider = 'fog/aws' | ||
config.fog_credentials = { | ||
provider: 'AWS', | ||
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], | ||
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | ||
region: 'us-west-2' | ||
} | ||
config.storage = :fog | ||
else | ||
config.storage = :file | ||
end | ||
|
||
if Rails.env.production? | ||
config.asset_host = 'https://s3.us-west-2.amazonaws.com/fae-engine-test-fly' | ||
config.fog_directory = 'fae-engine-test-fly' | ||
elsif Rails.env.remote_development? | ||
|
||
end | ||
|
||
# uncomment to deliver production assets to the local CMS | ||
# if Rails.env.development? | ||
# config.asset_host = '' | ||
# config.fog_directory = '' | ||
# end | ||
|
||
# uncomment to upload to bucket/cdn in local dev | ||
# if Rails.env.development? | ||
# config.fog_provider = 'fog/aws' | ||
# config.fog_credentials = { | ||
# provider: 'AWS', | ||
# aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], | ||
# aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | ||
# region: 'us-west-2' | ||
# } | ||
# config.storage = :fog | ||
# end | ||
|
||
end |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Puma can serve each request in a thread from an internal thread pool. | ||
# The `threads` method setting takes two numbers: a minimum and maximum. | ||
# Any libraries that use thread pools should be configured to match | ||
# the maximum value specified for Puma. Default is set to 5 threads for minimum | ||
# and maximum; this matches the default thread size of Active Record. | ||
# | ||
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } | ||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } | ||
threads min_threads_count, max_threads_count | ||
|
||
# Specifies the `worker_timeout` threshold that Puma will use to wait before | ||
# terminating a worker in development environments. | ||
# | ||
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" | ||
|
||
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. | ||
# | ||
port ENV.fetch("PORT") { 3000 } | ||
|
||
# Specifies the `environment` that Puma will run in. | ||
# | ||
environment ENV.fetch("RAILS_ENV") { "development" } | ||
|
||
# Specifies the `pidfile` that Puma will use. | ||
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } | ||
|
||
# Specifies the number of `workers` to boot in clustered mode. | ||
# Workers are forked web server processes. If using threads and workers together | ||
# the concurrency of the application would be max `threads` * `workers`. | ||
# Workers do not work on JRuby or Windows (both of which do not support | ||
# processes). | ||
# | ||
workers ENV.fetch("WEB_CONCURRENCY") { 4 } | ||
|
||
# Use the `preload_app!` method when specifying a `workers` number. | ||
# This directive tells Puma to first boot the application and load code | ||
# before forking the application. This takes advantage of Copy On Write | ||
# process behavior so workers use less memory. | ||
# | ||
preload_app! | ||
|
||
# Allow puma to be restarted by `bin/rails restart` command. | ||
plugin :tmp_restart |
This file was deleted.
Oops, something went wrong.
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.