forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
9489de1
commit 5f9bf07
Showing
4 changed files
with
96 additions
and
107 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,70 +1,57 @@ | ||
# Make sure it matches the Ruby version in .ruby-version and Gemfile | ||
ARG RUBY_VERSION=2.7.8 | ||
FROM ruby:${RUBY_VERSION}-alpine | ||
ARG RUBY_VERSION=3.2 | ||
FROM ruby:${RUBY_VERSION}-slim-bookworm | ||
|
||
RUN apk add --no-cache build-base \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
mariadb-dev \ | ||
git \ | ||
tzdata \ | ||
nodejs yarn \ | ||
less \ | ||
bash \ | ||
docker \ | ||
docker-compose \ | ||
cmake \ | ||
g++ \ | ||
make \ | ||
libc6-compat \ | ||
libstdc++ \ | ||
ruby-dev \ | ||
libffi-dev \ | ||
openssl-dev \ | ||
&& mkdir /node_modules | ||
|
||
|
||
# Rails app lives here | ||
WORKDIR /app | ||
|
||
# Set production environment | ||
RUN bash -c "set -o pipefail && apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
libxml2 \ | ||
libxslt-dev \ | ||
libmariadb-dev \ | ||
git \ | ||
curl \ | ||
libffi-dev \ | ||
pkg-config \ | ||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o /etc/apt/keyrings/nodesource.asc \ | ||
&& echo 'deb [signed-by=/etc/apt/keyrings/nodesource.asc] https://deb.nodesource.com/node_20.x nodistro main' | tee /etc/apt/sources.list.d/nodesource.list \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends nodejs \ | ||
&& corepack enable \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \ | ||
&& mkdir /node_modules" | ||
|
||
ARG RAILS_ENV="production" | ||
ARG NODE_ENV="production" | ||
ARG BUNDLE_WITHOUT="development test" | ||
|
||
ENV RAILS_LOG_TO_STDOUT="1" \ | ||
RAILS_SERVE_STATIC_FILES="true" \ | ||
RAILS_ENV="${RAILS_ENV}" \ | ||
NODE_ENV="${NODE_ENV}" \ | ||
BUNDLE_PATH=/usr/local/bundle \ | ||
BUNDLE_WITHOUT="${BUNDLE_WITHOUT}" | ||
|
||
# Update RubyGems and Bundler | ||
RUN gem update --system 3.4.22 && \ | ||
gem install bundler:2.4.22 | ||
#PATH="${PATH}:/node_modules/.bin" | ||
COPY Gemfile* . | ||
RUN bundle install | ||
|
||
# Copy Gemfile and Gemfile.lock first | ||
COPY Gemfile Gemfile.lock ./ | ||
COPY package.json *yarn* . | ||
RUN yarn install | ||
|
||
# Install gems | ||
RUN bundle config set --local build.nokogiri --use-system-libraries && \ | ||
bundle install --jobs 4 --retry 3 | ||
|
||
# Copy the rest of the application | ||
COPY . . | ||
|
||
# Install yarn packages and build | ||
RUN yarn install && yarn build | ||
|
||
# Copy configuration files | ||
RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb && \ | ||
cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb && \ | ||
cp config/database.yml.sample config/database.yml | ||
|
||
# Precompile bootsnap code for faster boot times | ||
RUN bundle exec bootsnap precompile --gemfile app/ lib/ | ||
RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb \ | ||
&& cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb \ | ||
&& cp config/bioportal_config_env.rb.sample config/bioportal_config_test.rb \ | ||
&& cp config/database.yml.sample config/database.yml | ||
|
||
# Precompile assets | ||
RUN SECRET_KEY_BASE_DUMMY="1" ./bin/rails assets:precompile | ||
RUN if [ "${RAILS_ENV}" != "development" ]; then \ | ||
bundle exec bootsnap precompile --gemfile app/ lib/ && \ | ||
SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile; fi | ||
|
||
ENV BINDING="0.0.0.0" | ||
EXPOSE 3000 | ||
|
||
CMD ["bash"] | ||
CMD ["rails", "s"] |
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 |
---|---|---|
|
@@ -26,5 +26,6 @@ | |
}, | ||
"scripts": { | ||
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |