Skip to content

Commit

Permalink
build docker UI image for ruby 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
imadbourouche committed Feb 24, 2025
1 parent ec0d302 commit ba92f7c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 44 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,32 @@ 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 }}
password: ${{ secrets.GITHUB_TOKEN }}

- 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
Expand All @@ -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
43 changes: 15 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 . .
Expand All @@ -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

Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -664,4 +664,4 @@ DEPENDENCIES
will_paginate (~> 3.0)

BUNDLED WITH
2.4.22
2.6.5

0 comments on commit ba92f7c

Please sign in to comment.