From ba92f7cbe01049b77165f230683dac6f826cf903 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Mon, 24 Feb 2025 17:29:57 +0100 Subject: [PATCH] build docker UI image for ruby 3.1 --- .github/workflows/docker-image.yml | 19 ++++++++----- Dockerfile | 43 +++++++++++------------------- Gemfile.lock | 18 ++++++------- 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 66b43155f..243944863 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,22 +15,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -38,7 +40,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | agroportal/ontoportal_web_ui @@ -50,7 +52,10 @@ jobs: context: . platforms: linux/amd64, linux/arm64 build-args: | - RUBY_VERSION=2.7.8 + RUBY_VERSION=3.1 + BUILDPLATFORM=${{ github.job_name }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 678383b14..425fa33fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,31 @@ # Make sure it matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.2 +ARG RUBY_VERSION=3.1 FROM ruby:${RUBY_VERSION}-slim-bookworm WORKDIR /app -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 \ +RUN 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 \ + && 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" + && apt-get clean && rm -rf /var/lib/apt/lists/* /usr/share/{doc,man} ENV RAILS_LOG_TO_STDOUT="1" \ RAILS_SERVE_STATIC_FILES="true" \ - RAILS_ENV="${RAILS_ENV}" \ - NODE_ENV="${NODE_ENV}" \ + RAILS_ENV="production" \ + NODE_ENV="production" \ BUNDLE_PATH=/usr/local/bundle \ - BUNDLE_WITHOUT="${BUNDLE_WITHOUT}" + BUNDLE_WITHOUT="development test" -#PATH="${PATH}:/node_modules/.bin" COPY Gemfile* . +RUN gem install bundler RUN bundle install -COPY package.json *yarn* . +COPY package.json *yarn* ./ +RUN mkdir /node_modules RUN yarn install COPY . . @@ -48,9 +35,9 @@ RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production. && cp config/bioportal_config_env.rb.sample config/bioportal_config_test.rb \ && cp config/database.yml.sample config/database.yml -RUN if [ "${RAILS_ENV}" != "development" ]; then \ - bundle exec bootsnap precompile --gemfile app/ lib/ && \ - SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile; fi +# RUN if [ "${RAILS_ENV}" != "development" ]; then \ +# bundle exec bootsnap precompile --gemfile app/ lib/ && \ +# SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile; fi EXPOSE 3000 diff --git a/Gemfile.lock b/Gemfile.lock index 493d108e7..efbe0f373 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -181,7 +181,7 @@ GEM sass-rails globalid (1.2.1) activesupport (>= 6.1) - graphql (2.4.9) + graphql (2.4.10) base64 fiber-storage logger @@ -257,7 +257,7 @@ GEM jwt (2.10.1) base64 language_server-protocol (3.17.0.4) - launchy (3.1.0) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) logger (~> 1.6) @@ -301,7 +301,7 @@ GEM mime-types (3.6.0) logger mime-types-data (~> 3.2015) - mime-types-data (3.2025.0204) + mime-types-data (3.2025.0220) mini_mime (1.1.5) minitest (5.25.4) msgpack (1.8.0) @@ -448,7 +448,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.4.0) + rexml (3.4.1) rouge (4.5.1) rspec-core (3.13.3) rspec-support (~> 3.13.0) @@ -467,7 +467,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.2) - rubocop (1.72.0) + rubocop (1.72.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -497,7 +497,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.28.0) + selenium-webdriver (4.29.1) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) @@ -534,7 +534,7 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) string-similarity (2.1.0) - stringio (3.1.3) + stringio (3.1.5) temple (0.10.3) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) @@ -555,7 +555,7 @@ GEM unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) uri (1.0.2) - version_gem (1.1.4) + version_gem (1.1.6) view_component (2.83.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) @@ -664,4 +664,4 @@ DEPENDENCIES will_paginate (~> 3.0) BUNDLED WITH - 2.4.22 + 2.6.5