-
Notifications
You must be signed in to change notification settings - Fork 4
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 #3133 from bitzesty/staging
production < staging
- Loading branch information
Showing
38 changed files
with
745 additions
and
294 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,2 +1,37 @@ | ||
.env | ||
vendor/bundle/* | ||
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. | ||
|
||
# Ignore git directory. | ||
/.git/ | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore all environment files (except templates). | ||
/.env* | ||
!/.env*.erb | ||
|
||
# Ignore all default key files. | ||
/config/master.key | ||
/config/credentials/*.key | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore pidfiles, but keep the directory. | ||
/tmp/pids/* | ||
!/tmp/pids/.keep | ||
|
||
# Ignore storage (uploaded files in development and any SQLite databases). | ||
/storage/* | ||
!/storage/.keep | ||
/tmp/storage/* | ||
!/tmp/storage/.keep | ||
|
||
# Ignore assets. | ||
/node_modules/ | ||
/app/assets/builds/* | ||
!/app/assets/builds/.keep | ||
/public/assets |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
20.16.0 |
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,2 +1,2 @@ | ||
ruby 3.2.2 | ||
nodejs 18.17.1 | ||
nodejs 20.16.0 |
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,21 +1,95 @@ | ||
ARG RUBY_VERSION=2.5.0 | ||
# syntax = docker/dockerfile:1 | ||
|
||
FROM convox/rails | ||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile | ||
ARG RUBY_VERSION=3.2.2 | ||
FROM ruby:$RUBY_VERSION-slim AS base | ||
|
||
ENV HOME=/app | ||
WORKDIR /app | ||
# Rails app lives here | ||
WORKDIR /rails | ||
|
||
ENV SSL_CERT_DIR=/etc/ssl/certs | ||
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt | ||
ENV HOME=/home/rails | ||
ENV USER=rails | ||
|
||
ENV DATABASE_URL postgresql://localhost/dummy_url | ||
ENV AWS_ACCESS_KEY_ID dummy | ||
ENV AWS_SECRET_ACCESS_KEY dummy | ||
# Set default to production, but allow override | ||
ARG RAILS_ENV=production | ||
ENV RAILS_ENV=${RAILS_ENV} | ||
|
||
ENV CURL_CONNECT_TIMEOUT=0 CURL_TIMEOUT=0 GEM_PATH="$HOME/vendor/bundle/ruby/${RUBY_VERSION}:$GEM_PATH" LANG=${LANG:-en_US.UTF-8} PATH="$HOME/bin:$HOME/vendor/bundle/bin:$HOME/vendor/bundle/ruby/${RUBY_VERSION}/bin:$PATH" RACK_ENV=${RACK_ENV:-production} RAILS_ENV=${RAILS_ENV:-production} RAILS_SERVE_STATIC_FILES=${RAILS_SERVE_STATIC_FILES:-enabled} SECRET_KEY_BASE=${SECRET_KEY_BASE:-PLACEHOLDERSECRETBASEKEY} | ||
# Set production environment | ||
ENV BUNDLE_DEPLOYMENT="1" \ | ||
BUNDLE_PATH="/usr/local/bundle" \ | ||
PATH="/usr/local/bundle/bin:$PATH" | ||
|
||
# Cache bundler | ||
COPY Gemfile /app/Gemfile | ||
COPY Gemfile.lock /app/Gemfile.lock | ||
COPY . /app | ||
RUN bundle install --without development test --jobs 4 && RAILS_ENV=production bundle exec rake assets:precompile | ||
# Conditionally set bundle config based on RAILS_ENV | ||
RUN if [ "$RAILS_ENV" = "production" ]; then \ | ||
echo "Setting production bundle config"; \ | ||
bundle config set --local deployment 'true'; \ | ||
bundle config set --local without 'development test'; \ | ||
else \ | ||
echo "Setting development bundle config"; \ | ||
bundle config set --local deployment 'false'; \ | ||
fi | ||
|
||
# Update gems and bundler | ||
RUN gem update --system --no-document && \ | ||
gem install -N bundler | ||
|
||
# Install packages needed for both production and development | ||
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 curl build-essential libpq-dev libvips node-gyp pkg-config python-is-python3 imagemagick libjemalloc2 postgresql-client | ||
|
||
# Install Node.js | ||
ARG NODE_VERSION=20.16.0 | ||
ENV PATH=/usr/local/node/bin:$PATH | ||
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ | ||
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ | ||
rm -rf /tmp/node-build-master | ||
|
||
# Install yarn | ||
ARG YARN_VERSION=1.22.22 | ||
RUN npm install -g yarn@$YARN_VERSION | ||
|
||
# Copy application code | ||
COPY . . | ||
RUN chmod +x /rails/bin/* | ||
|
||
# Install dependencies | ||
COPY --link Gemfile Gemfile.lock ./ | ||
RUN bundle install | ||
|
||
# Install node modules | ||
COPY --link package.json yarn.lock ./ | ||
RUN yarn install --frozen-lockfile | ||
|
||
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY | ||
RUN if [ "$RAILS_ENV" = "production" ]; then \ | ||
SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile; \ | ||
fi | ||
|
||
# Create rails user and set correct permissions | ||
RUN groupadd -r rails && useradd -r -g rails rails | ||
RUN mkdir -p $HOME && chown -R $USER:$USER $HOME /rails | ||
|
||
# Verify user creation and permissions | ||
RUN id rails && ls -la /rails/bin | ||
|
||
# Switch to rails user | ||
USER $USER | ||
|
||
# Add this line to ensure the HOME env is available to all processes | ||
ENV HOME=$HOME | ||
|
||
# Deployment options | ||
ENV LD_PRELOAD="libjemalloc.so.2" \ | ||
MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true" \ | ||
RAILS_LOG_TO_STDOUT="1" \ | ||
RAILS_SERVE_STATIC_FILES="true" \ | ||
RUBY_YJIT_ENABLE="1" | ||
|
||
# Entrypoint prepares the database. | ||
ENTRYPOINT ["/rails/bin/docker-entrypoint"] | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD ["./bin/rails", "server"] |
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
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 |
---|---|---|
|
@@ -59,3 +59,7 @@ input.form-control, select.form-control, | |
} | ||
} | ||
} | ||
|
||
.qae-form { | ||
margin-bottom: 50px; | ||
} |
Oops, something went wrong.