diff --git a/.devcontainer/Dockerfile.devcontainer b/.devcontainer/Dockerfile.devcontainer index 1af34197..a088c0b8 100644 --- a/.devcontainer/Dockerfile.devcontainer +++ b/.devcontainer/Dockerfile.devcontainer @@ -1,18 +1,22 @@ # Primary image -FROM mcr.microsoft.com/devcontainers/ruby:1-3.2-bookworm +FROM mcr.microsoft.com/devcontainers/base:debian-12 # apt caching & install packages -RUN rm -f /etc/apt/apt.conf.d/docker-clean; \ +RUN rm -f /etc/apt/apt.conf.d/docker-clean && \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache -RUN \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ + +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update && \ - apt-get install --no-install-recommends --no-install-suggests -y \ + apt-get install --no-install-recommends --no-install-suggests -qqy \ + libicu-dev \ + abiword \ autoconf \ build-essential \ ca-certificates \ curl \ + ffmpeg \ + ffmpegthumbnailer \ gnupg \ iputils-ping \ libblas-dev \ @@ -25,18 +29,18 @@ RUN \ libncurses5-dev \ libpq-dev \ libreadline6-dev \ + libreoffice \ + libsqlite3-dev \ libssl-dev \ libvips42 \ libyaml-dev \ patch \ - uuid-dev \ - zlib1g-dev \ - watchman \ - ffmpeg \ - ffmpegthumbnailer \ - abiword \ pdftohtml \ - libreoffice + pkg-config \ + rustc \ + uuid-dev \ + watchman \ + zlib1g-dev # Install postgres 15 client RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ @@ -44,8 +48,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ sudo install -d /usr/share/postgresql-common/pgdg && \ curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \ sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \ - apt update && \ - apt-get install --no-install-recommends --no-install-suggests -y \ + sudo apt update && \ + sudo apt-get install --no-install-recommends --no-install-suggests -qqy \ postgresql-client-15 # Install & configure delta diff tool @@ -63,22 +67,36 @@ RUN git config --system core.pager "delta" && \ git config --system diff.algorithm "histogram" && \ git config --system diff.colorMoved "default" +# Install ruby +USER vscode +RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv +ENV PATH="/home/vscode/.rbenv/bin:/home/vscode/.rbenv/shims:$PATH" +RUN echo 'eval "$(rbenv init - --no-rehash bash)"' >> ~/.bashrc +RUN git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build +RUN rbenv install 3.4.4 && \ + rbenv global 3.4.4 + ENV RAILS_ENV development -# [Optional] Uncomment this line to install additional gems. -RUN su vscode -c "gem install bundler -v '2.5.6'" && \ - su vscode -c "gem install rake -v '13.0.6'" && \ - su vscode -c "gem install ruby-lsp -v '0.22.1'" +# Pre install gems to speed up container startup +USER root +RUN mkdir -p /tmp/bundle-install-cache && \ + chown -R vscode:vscode /tmp/bundle-install-cache +WORKDIR /tmp/bundle-install-cache +USER vscode +COPY Gemfile.lock Gemfile ./ +COPY gems/has_aux_table ./gems/has_aux_table +RUN BUNDLE_FROZEN=true MAKE="make -j$(nproc)" bundle install --jobs $(nproc) # install exo -RUN su vscode -c "curl -sL https://exo.deref.io/install | bash" +RUN curl -sL https://exo.deref.io/install | bash ENV PATH "/home/vscode/.exo/bin:$PATH" # install just (command runner) -RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin +RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin -RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install 18 && nvm use 18 && npm install -g yarn" 2>&1 -ENV PATH /usr/local/share/nvm/current/bin:$PATH +# RUN source /usr/local/share/nvm/nvm.sh && nvm install 18 && nvm use 18 && npm install -g yarn 2>&1 +# ENV PATH /usr/local/share/nvm/current/bin:$PATH -# install `backlog` tool -RUN su vscode -c "npm i -g backlog.md" +# # install `backlog` tool +# RUN npm i -g backlog.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f6d1d66d..96731ff6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,26 @@ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "features": { "ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {}, - "ghcr.io/nikobockerman/devcontainer-features/fish-persistent-data:2": {} + "ghcr.io/nikobockerman/devcontainer-features/fish-persistent-data:2": {}, + "ghcr.io/devcontainers-extra/features/npm-package:1": { + "package": "backlog.md" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "Shopify.ruby-extensions-pack", + "dbaeumer.vscode-eslint", + "aliariff.vscode-erb-beautify", + "bradlc.vscode-tailwindcss", + "KoichiSasada.vscode-rdbg", + "qwtel.sqlite-viewer", + "esbenp.prettier-vscode", + "ms-azuretools.vscode-docker", + "1YiB.rust-bundle", + "rust-lang.rust-analyzer" + ] + } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. // This can be used to network with other containers or the host. diff --git a/.devcontainer/fish-shell-conf-d/rbenv.fish b/.devcontainer/fish-shell-conf-d/rbenv.fish new file mode 100644 index 00000000..d1231197 --- /dev/null +++ b/.devcontainer/fish-shell-conf-d/rbenv.fish @@ -0,0 +1 @@ +status --is-interactive; and rbenv init - --no-rehash fish | source diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..567aa29f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gems/has_aux_table"] + path = gems/has_aux_table + url = ssh://git@git.dy.mk:2221/dymk/has_aux_table.git diff --git a/.ruby-version b/.ruby-version index 5b820117..f9892605 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -system \ No newline at end of file +3.4.4 diff --git a/Dockerfile b/Dockerfile index 5323eb58..827afaab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Primary image -FROM ruby:3.2.6 +FROM ruby:3.4.4 USER root # apt caching & install packages @@ -14,10 +14,10 @@ RUN \ libblas-dev liblapack-dev # preinstall gems that take a long time to install -RUN MAKE="make -j12" gem install bundler -v '2.5.6' --verbose -RUN MAKE="make -j12" gem install rice -v '4.3.3' --verbose -RUN MAKE="make -j12" gem install faiss -v '0.3.2' --verbose -RUN MAKE="make -j12" gem install rails_live_reload -v '0.3.6' --verbose +RUN MAKE="make -j12" gem install bundler -v '2.6.7' +RUN MAKE="make -j12" gem install rice -v '4.3.3' +RUN MAKE="make -j12" gem install faiss -v '0.3.2' +RUN MAKE="make -j12" gem install rails_live_reload -v '0.3.6' RUN bundle config --global frozen 1 # set up nodejs 18.x deb repo @@ -46,9 +46,8 @@ RUN \ WORKDIR /usr/src/app COPY Gemfile Gemfile.lock ./ -RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config -RUN bundle config --local frozen 1 -RUN --mount=type=ssh bundle install +COPY gems/has_aux_table ./gems/has_aux_table +RUN ls -lah gems && BUNDLE_FROZEN=true MAKE="make -j$(nproc)" bundle install --jobs $(nproc) # install js dependencies COPY package.json yarn.lock ./ diff --git a/Gemfile b/Gemfile index ae7f95f3..6408f426 100644 --- a/Gemfile +++ b/Gemfile @@ -1,20 +1,17 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby "~> 3.2" +ruby "~> 3" +gem "bundler", "~> 2.6.7" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 7.2" -gem "has_aux_table", - git: "ssh://git@git.dy.mk:2221/dymk/has_aux_table.git", - branch: "main" +gem "has_aux_table", path: "gems/has_aux_table" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" -# Use sqlite3 as the database for Active Record gem "pg" -gem "sqlite3", "~> 1.4" gem "pry" gem "pry-stack_explorer" @@ -58,7 +55,7 @@ gem "bootsnap", require: false group :development, :test, :staging do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem - gem "debug", "~> 1.10", platforms: %i[mri mingw x64_mingw] + gem "debug", "~> 1.11", platforms: %i[mri mingw x64_mingw] end group :development, :staging do diff --git a/Gemfile.lock b/Gemfile.lock index ac951a6a..334cf034 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,10 +24,8 @@ GIT railties websocket-driver -GIT - remote: ssh://git@git.dy.mk:2221/dymk/has_aux_table.git - revision: fb7912e3536c339cba55af54c3e647f69f5997f3 - branch: main +PATH + remote: gems/has_aux_table specs: has_aux_table (0.1.0) activerecord (>= 7.0) @@ -155,7 +153,7 @@ GEM db-query-matchers (0.14.0) activesupport (>= 4.0, < 8.1) rspec (>= 3.0) - debug (1.10.0) + debug (1.11.0) irb (~> 1.10) reline (>= 0.3.8) debug_inspector (1.2.0) @@ -212,16 +210,22 @@ GEM fugit (>= 1.11.0) railties (>= 6.1.0) thor (>= 1.0.0) - google-protobuf (4.29.2-aarch64-linux) + google-protobuf (4.31.1-aarch64-linux-gnu) bigdecimal rake (>= 13) - google-protobuf (4.29.2-arm64-darwin) + google-protobuf (4.31.1-aarch64-linux-musl) bigdecimal rake (>= 13) - google-protobuf (4.29.2-x86_64-darwin) + google-protobuf (4.31.1-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.29.2-x86_64-linux) + google-protobuf (4.31.1-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.31.1-x86_64-linux-gnu) + bigdecimal + rake (>= 13) + google-protobuf (4.31.1-x86_64-linux-musl) bigdecimal rake (>= 13) htmlbeautifier (1.4.3) @@ -589,10 +593,6 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.7.3-aarch64-linux) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86_64-darwin) - sqlite3 (1.7.3-x86_64-linux) stackprof (0.2.26) stimulus-rails (1.3.4) railties (>= 6.0.0) @@ -669,6 +669,7 @@ DEPENDENCIES addressable attr_json bootsnap + bundler (~> 2.6.7) capybara charlock_holmes cloudflare-rails @@ -679,7 +680,7 @@ DEPENDENCIES curb daemons db-query-matchers (~> 0.14) - debug (~> 1.10) + debug (~> 1.11) devise (~> 4.9) dhash-vips discard @@ -742,7 +743,6 @@ DEPENDENCIES spring-commands-parallel-tests spring-commands-rspec sprockets-rails - sqlite3 (~> 1.4) stackprof stimulus-rails syntax_tree (~> 6.2) @@ -762,4 +762,4 @@ RUBY VERSION ruby 3.2.6p234 BUNDLED WITH - 2.6.2 + 2.6.7 diff --git a/gems/has_aux_table b/gems/has_aux_table new file mode 160000 index 00000000..fb7912e3 --- /dev/null +++ b/gems/has_aux_table @@ -0,0 +1 @@ +Subproject commit fb7912e3536c339cba55af54c3e647f69f5997f3