From bbf3fb91a0389ab4c3fd9440b049a703425b28e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 22 Feb 2024 10:47:21 +0100 Subject: [PATCH 1/3] Fix Ruby in Docker container on Apple silicon --- Dockerfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7da4b88..00d8559 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ # syntax=docker/dockerfile:1 -FROM ruby:3.3.0 +FROM debian:bullseye-slim as base SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN apt-get update -qq && apt-get install -y --no-install-recommends curl \ - ldap-utils tini libvips +# TODO Remove when upstream Ruby works properly on Apple silicon +RUN apt update && apt install -y build-essential wget autoconf libpq-dev +RUN wget https://github.com/postmodern/ruby-install/releases/download/v0.9.3/ruby-install-0.9.3.tar.gz \ + && tar -xzvf ruby-install-0.9.3.tar.gz \ + && cd ruby-install-0.9.3/ \ + && make install +RUN ruby-install -p https://github.com/ruby/ruby/pull/9371.diff ruby 3.3.0 +ENV PATH="/opt/rubies/ruby-3.3.0/bin:${PATH}" + +RUN apt-get install -y --no-install-recommends curl ldap-utils tini libvips RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - RUN apt-get update && apt-get install -y nodejs From ba7c3795f810191054c3929e2d8310d370de1aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 22 Feb 2024 11:29:56 +0100 Subject: [PATCH 2/3] Add pkg-config --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 00d8559..a6f8081 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM debian:bullseye-slim as base SHELL ["/bin/bash", "-o", "pipefail", "-c"] # TODO Remove when upstream Ruby works properly on Apple silicon -RUN apt update && apt install -y build-essential wget autoconf libpq-dev +RUN apt update && apt install -y build-essential wget autoconf libpq-dev pkg-config RUN wget https://github.com/postmodern/ruby-install/releases/download/v0.9.3/ruby-install-0.9.3.tar.gz \ && tar -xzvf ruby-install-0.9.3.tar.gz \ && cd ruby-install-0.9.3/ \ From 56d91083e5d732fab43e459d968f83477f4cf843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Thu, 22 Feb 2024 13:24:41 +0100 Subject: [PATCH 3/3] Fix seeds for new keyword argument --- db/seeds.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index dd13a45..fa957a6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -3,10 +3,10 @@ require 'sidekiq/testing' ldap = LdapService.new Sidekiq::Testing.inline! do - CreateAccount.call( + CreateAccount.call(account: { username: "admin", domain: "kosmos.org", email: "admin@example.com", password: "admin is admin", confirmed: true - ) + }) ldap.add_attribute "cn=admin,ou=kosmos.org,cn=users,dc=kosmos,dc=org", :admin, "true" @@ -15,9 +15,9 @@ Sidekiq::Testing.inline! do email = Faker::Internet.unique.email next if username.length < 3 - CreateAccount.call( + CreateAccount.call(account: { username: username, domain: "kosmos.org", email: email, password: "user is user", confirmed: true - ) + }) end end