From 4c31dbbed061a89906d6ab7ff6ecd51e0e5f7177 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 16 May 2025 18:01:29 +0200 Subject: [PATCH] Update docker --- .ruby-version | 2 +- Dockerfile | 136 ++++++++++----- Gemfile | 3 +- Gemfile.lock | 383 ++++++++++++++++++++++-------------------- bin/build | 70 ++++++++ bin/docker-entrypoint | 18 +- compose.yml | 59 +++++++ 7 files changed, 441 insertions(+), 230 deletions(-) create mode 100755 bin/build create mode 100644 compose.yml diff --git a/.ruby-version b/.ruby-version index f13c6f4..0f9e134 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.5 +ruby-3.4 diff --git a/Dockerfile b/Dockerfile index f588cdd..4573018 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,17 @@ -ARG RUBY_VERSION=3.2.5 - -FROM ruby:${RUBY_VERSION} - -LABEL maintainer='david@hohl.cloud' +ARG RUBY_VERSION=3.4 ARG NAME=app ARG UID=1000 ARG GID=1000 -ARG APP_PORT=3000 -ARG INSTALL_DIR=/${NAME} +ARG INSTALL_DIR=/home/${NAME}/src + +FROM ruby:${RUBY_VERSION} as development + +LABEL maintainer='david@hohl.cloud' + ARG NAME ARG UID ARG GID -ARG APP_PORT ARG INSTALL_DIR WORKDIR ${INSTALL_DIR} @@ -40,6 +39,7 @@ RUN \ --disabled-login \ --shell /bin/bash \ ${NAME} && \ + chown -R ${NAME}:${NAME} /home/${NAME} && \ apt-get update && \ apt-get install -yqq --no-install-recommends \ gnupg2 \ @@ -48,52 +48,100 @@ RUN \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt-get update -yqq && \ apt-get install -yqq --no-install-recommends \ - sqlite3 nodejs npm sassc yarn libvips fish ranger pandoc libjemalloc2 && \ + sqlite3 nodejs npm sassc yarn libvips libjemalloc2 && \ apt-get clean && \ - npm i -g vscode-langservers-extracted \ - dockerfile-language-server-nodejs \ - @microsoft/compose-language-service \ - yaml-language-server@next \ - bash-language-server \ - typescript-language-server typescript && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ truncate -s 0 /var/log/*log && \ gem update --system && \ - bundle config set app_config ${GEM_HOME} && \ - mkdir -p /home/${NAME}/.ssh && \ - echo "|1|MY0IaoqveusfUdYlTFzGnB95mhI=|XyUGTfOoKc7vGP5WTlFwT1RU+5E= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOLCA3O6oc0+BplWjB5Vi4jPNnGAYo24oANcylCc9i8W\ - |1|pYFp+C6PAszoVmLOZliWYonpzC0=|QbeRMKsmnFBrqoH38UKkjZdISJI= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2PqML1VEXRdMc/WTjjN00FWw2vDl11q+0glBLQwQiBV5r3kL1kXWP7rUtuBPfivz4/ZpzkpHhWbKbnrLazpvSRHqwgMm6S1mQoH4Gb3wLwCqvoE/M8BSJsXvlJem63y/W4mtQEboZ+YyBzW1Yss41jBW9tfQxXCVlikPWm/O20hr3uealymIH5GaONE65mY9JfPr7z6AAJZ8bAfO69HWp+Q1dRD2sin3/cY+a25eQ6PWmR7g/Xw3/6pNikOj2LMErZdyCxVhCKmHeDDrWzn8qJgfPRqz9Pneb3qIBOw6kJnTfQGc+7KLZmmqRUChoLuw5jTYthngZVXJ/A0XJG30mqtrQj9uD7vqmTFXZl8wNuv52ELOwPrvJIpEFvjjNGbg8iRkjElHKub8eGvQhy/sH96Xv6WqxfGiXvyUTWrBOdhhL102fA+nXcsx90Ln0/Rjg5v5meFCT1a+3SLgQeQ44c9xasDwGFrwlR1x4uP8249SldIhKFO+1oXnskTN8Prs=\ -|1|FisNvukDUhT0l2SVq4qFF1WFoBQ=|rBWKChHJabb1lM0Og5zcH3lxrOQ= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPknmThDfyVupOSMcGdjP14VEX6e5rXrI3ny+FnLjaCNyGYt7hKyRTfvl32UVXFZqvp+gp6BVdqaKI6ey5Mygfs=" >> /home/${NAME}/.ssh/known_hosts + bundle config set app_config ${GEM_HOME} ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 -RUN curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-x86_64.gz \ - | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo - -# RUN curl -fsSL https://github.com/Feel-ix-343/markdown-oxide/releases/download/v0.24.3/markdown-oxide-v0.24.3-x86_64-unknown-linux-gnu | install -m 755 /dev/stdin /usr/local/bin/markdown-oxide - -RUN curl -fsSL https://github.com/artempyanykh/marksman/releases/download/2024-11-20/marksman-linux-x64 | install -m 755 /dev/stdin /usr/local/bin/marksman - -ARG HELIX_VERSION=24.07 -RUN curl -L https://github.com/helix-editor/helix/releases/download/${HELIX_VERSION}/helix-${HELIX_VERSION}-x86_64-linux.tar.xz -o /tmp/helix.tar.xz && \ - cd /opt/ && \ - tar -xf /tmp/helix.tar.xz && \ - ln -s /opt/helix-${HELIX_VERSION}-x86_64-linux/hx /usr/local/bin - -RUN mkdir -p /home/app/.config/{helix, fish} - -RUN mkdir -p /home/app/.config/helix/runtime/queries/slim && \ - curl https://raw.githubusercontent.com/kolen/tree-sitter-slim/refs/heads/master/queries/highlights.scm -o /home/app/.config/helix/runtime/queries/slim/highlights.scm && \ - curl https://raw.githubusercontent.com/kolen/tree-sitter-slim/refs/heads/master/queries/injections.scm -o /home/app/.config/helix/runtime/queries/slim/injections.scm && \ - chown 1000:1000 -R /home/app - -RUN mkdir -p /opt/helix-${HELIX_VERSION}-x86_64-linux/runtime/queries/slim && \ - curl https://raw.githubusercontent.com/kolen/tree-sitter-slim/refs/heads/master/queries/highlights.scm -o /opt/helix-${HELIX_VERSION}-x86_64-linux/runtime/queries/slim/highlights.scm && \ - curl https://raw.githubusercontent.com/kolen/tree-sitter-slim/refs/heads/master/queries/injections.scm -o /opt/helix-${HELIX_VERSION}-x86_64-linux/runtime/queries/slim/injections.scm - COPY bin/dev_entrypoint /usr/local/bin/dev_entrypoint USER ${NAME} ENTRYPOINT ["/usr/local/bin/dev_entrypoint"] + CMD ["/bin/sh", "-c", "dev"] + +FROM development AS build + +USER root + +# Wir wollen die bundles nicht im app directory +ENV GEM_HOME=/usr/local/bundle \ + BUNDLE_WITHOUT="development test" \ + RAILS_ENV=production \ + SECRET_KEY_BASE_DUMMY=1 + +ENV PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH + +COPY ./Gemfile ./Gemfile.lock ./ + + +RUN bundle config set app_config ${GEM_HOME} && \ + bundle config && \ + bundle install && \ + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ + bundle exec bootsnap precompile --gemfile + +RUN bundle config +COPY . . + +RUN bundle exec bootsnap precompile app/ lib/ && \ + rails assets:precompile && \ + rm -rf log/* tmp/* && \ + chown -R ${NAME}:${NAME} log tmp + + +FROM ruby:${RUBY_VERSION}-slim AS release + +ARG UID +ARG GID +ARG NAME=app +ARG INSTALL_DIR +ARG BUILD_DIR=${INSTALL_DIR} +ARG INSTALL_DIR=/app + +ENV GEM_HOME=/usr/local/bundle \ + BUNDLE_WITHOUT="development test" \ + BUNDLE_SYSTEM=1 \ + RAILS_ENV=production \ + LANG=C.UTF-8 \ + INSTALL_DIR=${INSTALL_DIR} \ + TZ=Europe/Zurich + +ENV PATH=${INSTALL_DIR}/bin:$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH + +WORKDIR ${INSTALL_DIR} + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ + echo $TZ > /etc/timezone && \ + adduser --disabled-password --disabled-login ${NAME} &&\ + apt-get update -yqq && \ + apt-get install -yqq --no-install-recommends \ + sqlite3 libjemalloc2 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + gem update --system && \ + truncate -s 0 /var/log/*log + +ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 + +RUN pwd + +COPY --from=build ${GEM_HOME} ${GEM_HOME} +COPY --from=build ${BUILD_DIR} . + +RUN ls -la && chown -R ${NAME}:${NAME} ./tmp ./log ./storage + +EXPOSE 3000 + +ENTRYPOINT ["bin/docker-entrypoint"] + +USER ${NAME} + +CMD ["./bin/rails", "server", "-b", "0"] + + diff --git a/Gemfile b/Gemfile index 7268a2b..67d1a34 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,6 @@ source "https://rubygems.org" -ruby "3.2.5" - # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 8.0" @@ -50,6 +48,7 @@ gem "bootsnap", require: false gem "bootstrap_form" gem "caxlsx" gem "caxlsx_rails" +gem "deepl-rb", require: "deepl" gem "image_processing", "~> 1.2" gem "openxml-docx" gem "pagy", "~> 9.0" diff --git a/Gemfile.lock b/Gemfile.lock index c9d597d..bf0065f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,29 @@ GEM remote: https://rubygems.org/ specs: - actioncable (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + actioncable (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actionmailbox (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) mail (>= 2.8.0) - actionmailer (8.0.0) - actionpack (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activesupport (= 8.0.0) + actionmailer (8.0.2) + actionpack (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activesupport (= 8.0.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.0) - actionview (= 8.0.0) - activesupport (= 8.0.0) + actionpack (8.0.2) + actionview (= 8.0.2) + activesupport (= 8.0.2) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -31,35 +31,35 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.0) - actionpack (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + actiontext (8.0.2) + actionpack (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.0) - activesupport (= 8.0.0) + actionview (8.0.2) + activesupport (= 8.0.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.0) - activesupport (= 8.0.0) + activejob (8.0.2) + activesupport (= 8.0.2) globalid (>= 0.3.6) - activemodel (8.0.0) - activesupport (= 8.0.0) - activerecord (8.0.0) - activemodel (= 8.0.0) - activesupport (= 8.0.0) + activemodel (8.0.2) + activesupport (= 8.0.2) + activerecord (8.0.2) + activemodel (= 8.0.2) + activesupport (= 8.0.2) timeout (>= 0.4.0) - activestorage (8.0.0) - actionpack (= 8.0.0) - activejob (= 8.0.0) - activerecord (= 8.0.0) - activesupport (= 8.0.0) + activestorage (8.0.2) + actionpack (= 8.0.2) + activejob (= 8.0.2) + activerecord (= 8.0.2) + activesupport (= 8.0.2) marcel (~> 1.0) - activesupport (8.0.0) + activesupport (8.0.2) base64 benchmark (>= 0.3) bigdecimal @@ -74,18 +74,18 @@ GEM uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - ast (2.4.2) + ast (2.4.3) base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindex (0.8.1) - bootsnap (1.18.3) + bootsnap (1.18.6) msgpack (~> 1.2) bootstrap_form (5.4.0) actionpack (>= 6.1) activemodel (>= 6.1) - brakeman (6.1.2) + brakeman (7.0.2) racc builder (3.3.0) capybara (3.40.0) @@ -97,7 +97,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - caxlsx (4.1.0) + caxlsx (4.2.0) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) @@ -105,25 +105,28 @@ GEM caxlsx_rails (0.6.4) actionpack (>= 3.1) caxlsx (>= 3.0) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) crass (1.0.6) - cssbundling-rails (1.4.0) + cssbundling-rails (1.4.3) railties (>= 6.0.0) - date (3.4.0) - debug (1.9.2) + date (3.4.1) + debug (1.10.0) irb (~> 1.10) reline (>= 0.3.8) + deepl-rb (3.2.0) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) et-orbi (1.2.11) tzinfo - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) @@ -133,24 +136,26 @@ GEM html2slim (0.2.0) hpricot htmlentities (4.3.4) - i18n (1.14.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) - image_processing (1.12.2) - mini_magick (>= 4.9.5, < 5) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) - io-console (0.7.2) - irb (1.14.0) + io-console (0.8.0) + irb (1.15.2) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.12.0) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - jsbundling-rails (1.3.0) + jsbundling-rails (1.3.1) railties (>= 6.0.0) - json (2.7.2) - language_server-protocol (3.17.0.3) - logger (1.6.1) - loofah (2.22.0) + json (2.12.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -160,31 +165,37 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - mini_magick (4.13.2) + mini_magick (5.2.0) + benchmark + logger mini_mime (1.1.5) - minitest (5.24.1) - msgpack (1.7.2) - net-imap (0.5.0) + minitest (5.25.5) + msgpack (1.8.0) + net-imap (0.5.8) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.6-aarch64-linux) + nio4r (2.7.4) + nokogiri (1.18.8-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.6-arm-linux) + nokogiri (1.18.8-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.6-arm64-darwin) + nokogiri (1.18.8-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.6-x86-linux) + nokogiri (1.18.8-arm-linux-musl) racc (~> 1.4) - nokogiri (1.16.6-x86_64-darwin) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.6-x86_64-linux) + nokogiri (1.18.8-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.8-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.8-x86_64-linux-musl) racc (~> 1.4) openxml-docx (0.11.5) nokogiri @@ -194,77 +205,83 @@ GEM openxml-drawingml (0.3.1) nokogiri openxml-package (~> 0.3.2) - openxml-package (0.3.4) + openxml-package (0.3.5) nokogiri ox - rubyzip - ox (2.14.18) - pagy (9.0.2) + rubyzip (~> 2.3) + ox (2.14.22) + bigdecimal (>= 3.0) + pagy (9.3.4) pandoc-ruby (2.1.10) - parallel (1.25.1) - parser (3.3.4.0) + parallel (1.27.0) + parser (3.3.8.0) ast (~> 2.4.1) racc pdf-core (0.10.0) + pp (0.6.2) + prettyprint prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) ttfunk (~> 1.8) - prawn-markup (1.0.0) + prawn-markup (1.1.0) nokogiri prawn prawn-table - prawn-rails (1.4.2) + prawn-rails (1.6.0) actionview (>= 3.1.0) + activesupport (>= 3.1.0) prawn prawn-table prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - prism (1.2.0) + prettyprint (0.2.0) + prism (1.4.0) propshaft (1.1.0) actionpack (>= 7.0.0) activesupport (>= 7.0.0) rack railties (>= 7.0.0) - psych (5.1.2) + psych (5.2.6) + date stringio - public_suffix (6.0.0) - puma (6.4.2) + public_suffix (6.0.2) + puma (6.6.0) nio4r (~> 2.0) raabro (1.4.0) - racc (1.8.0) - rack (3.1.7) - rack-session (2.0.0) + racc (1.8.1) + rack (3.1.14) + rack-session (2.1.1) + base64 (>= 0.1.0) rack (>= 3.0.0) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (8.0.0) - actioncable (= 8.0.0) - actionmailbox (= 8.0.0) - actionmailer (= 8.0.0) - actionpack (= 8.0.0) - actiontext (= 8.0.0) - actionview (= 8.0.0) - activejob (= 8.0.0) - activemodel (= 8.0.0) - activerecord (= 8.0.0) - activestorage (= 8.0.0) - activesupport (= 8.0.0) + rails (8.0.2) + actioncable (= 8.0.2) + actionmailbox (= 8.0.2) + actionmailer (= 8.0.2) + actionpack (= 8.0.2) + actiontext (= 8.0.2) + actionview (= 8.0.2) + activejob (= 8.0.2) + activemodel (= 8.0.2) + activerecord (= 8.0.2) + activestorage (= 8.0.2) + activesupport (= 8.0.2) bundler (>= 1.15.0) - railties (= 8.0.0) + railties (= 8.0.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (8.0.0) - actionpack (= 8.0.0) - activesupport (= 8.0.0) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.2) + actionpack (= 8.0.2) + activesupport (= 8.0.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -272,62 +289,62 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rbs (3.6.1) + rbs (3.9.4) logger - rdoc (6.7.0) + rdoc (6.13.1) psych (>= 4.0.0) - regexp_parser (2.9.2) - reline (0.5.9) + regexp_parser (2.10.0) + reline (0.6.1) io-console (~> 0.5) - rexml (3.3.2) - strscan - rubocop (1.65.0) + rexml (3.4.1) + rubocop (1.75.6) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) - parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-minitest (0.35.1) - rubocop (>= 1.61, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-performance (1.21.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.25.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.44.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-performance (1.25.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails (2.31.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails-omakase (1.0.0) - rubocop - rubocop-minitest - rubocop-performance - rubocop-rails - ruby-lsp (0.20.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails-omakase (1.1.0) + rubocop (>= 1.72) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.30) + ruby-lsp (0.23.20) language_server-protocol (~> 3.17.0) prism (>= 1.2, < 2.0) rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) - ruby-lsp-rails (0.3.21) - ruby-lsp (>= 0.20.0, < 0.21.0) + ruby-lsp-rails (0.4.3) + ruby-lsp (>= 0.23.18, < 0.24.0) ruby-progressbar (1.13.0) - ruby-vips (2.2.1) + ruby-vips (2.2.3) ffi (~> 1.12) - rubyzip (2.3.2) + logger + rubyzip (2.4.1) sablon (0.4.1) nokogiri (>= 1.8.5) rubyzip (>= 1.3.0) - securerandom (0.3.1) - selenium-webdriver (4.23.0) + securerandom (0.4.1) + selenium-webdriver (4.32.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) @@ -336,60 +353,64 @@ GEM slim (5.2.1) temple (~> 0.10.0) tilt (>= 2.1.0) - solid_queue (1.0.1) + solid_queue (1.1.5) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) fugit (~> 1.11.0) railties (>= 7.1) thor (~> 1.3.1) - sorbet-runtime (0.5.11625) - sqlite3 (2.2.0-aarch64-linux-gnu) - sqlite3 (2.2.0-arm-linux-gnu) - sqlite3 (2.2.0-arm64-darwin) - sqlite3 (2.2.0-x86-linux-gnu) - sqlite3 (2.2.0-x86_64-darwin) - sqlite3 (2.2.0-x86_64-linux-gnu) - stimulus-rails (1.3.3) + sorbet-runtime (0.5.12109) + sqlite3 (2.6.0-aarch64-linux-gnu) + sqlite3 (2.6.0-aarch64-linux-musl) + sqlite3 (2.6.0-arm-linux-gnu) + sqlite3 (2.6.0-arm-linux-musl) + sqlite3 (2.6.0-arm64-darwin) + sqlite3 (2.6.0-x86_64-darwin) + sqlite3 (2.6.0-x86_64-linux-gnu) + sqlite3 (2.6.0-x86_64-linux-musl) + stimulus-rails (1.3.4) railties (>= 6.0.0) - stringio (3.1.1) - strscan (3.1.0) + stringio (3.1.7) temple (0.10.3) - thor (1.3.1) - tilt (2.4.0) - timeout (0.4.1) + thor (1.3.2) + tilt (2.6.0) + timeout (0.4.3) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbo-rails (2.0.5) - actionpack (>= 6.0.0) - activejob (>= 6.0.0) - railties (>= 6.0.0) + turbo-rails (2.0.13) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) - uri (1.0.1) - useragent (0.16.10) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.3) + useragent (0.16.11) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.1) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.7.2) PLATFORMS - aarch64-linux - arm-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl arm64-darwin - x86-linux x86_64-darwin - x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES bcrypt (~> 3.1.7) @@ -401,6 +422,7 @@ DEPENDENCIES caxlsx_rails cssbundling-rails debug + deepl-rb html2slim image_processing (~> 1.2) jbuilder @@ -429,8 +451,5 @@ DEPENDENCIES tzinfo-data web-console -RUBY VERSION - ruby 3.2.5p208 - BUNDLED WITH - 2.5.15 + 2.6.2 diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..31c1d20 --- /dev/null +++ b/bin/build @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +server=phela + +# Save current stash state +initial_stash_count=$(git stash list | wc -l) + +# Check if working directory is clean +if [[ -n $(git status --porcelain) ]]; then + echo "Repository is dirty. Stashing changes..." + git stash push --include-untracked --quiet + stashed=true +else + echo "Repository is clean." + stashed=false +fi + +if [[ -n "$1" ]]; then + tag="$1" +else + tag=$(git describe --tags --exact-match 2>/dev/null) +fi + +if [[ -n $tag ]]; then + echo "Current Git tag: $tag" +else + branch=$(git rev-parse --abbrev-ref HEAD) + tag=$branch-$(git rev-parse HEAD) + echo "Current commit SHA-1: $tag" +fi + +baseimage=code.hohl.cloud/jwa11y/a11yist +image=$baseimage:$tag + +echo "Building tag $image" +docker build --progress quiet -t $image --target release . + + +# Restore the stash if we stashed +if [ "$stashed" = true ]; then + echo "Restoring stashed changes..." + current_stash_count=$(git stash list | wc -l) + if (( current_stash_count > initial_stash_count )); then + git stash pop --quiet + echo "Changes restored." + else + echo "No stash to restore." + fi +else + echo "No changes to restore." +fi + +echo "Pushing image $image" +docker push --quiet $image + +read -p "Do you want to SSH into $server and run 'deploy'? [y/N] " answer +if [[ "$answer" =~ ^[Yy]$ ]]; then + echo "Connecting to $server and running 'deploy'..." + baseimage_esc=$(echo $baseimage | sed 's/\//\\\//g' | sed 's/\./\\\./g') + tag_esc=$(echo $image | sed 's/\//\\\//g' | sed 's/\./\\\./g') + read -r -d '' remote_script <> deployments.log +REMOTE + echo "Execute deployment" + echo "$remote_script" | ssh "$server" "bash -s" +fi + diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint index 67ef493..f89fe81 100755 --- a/bin/docker-entrypoint +++ b/bin/docker-entrypoint @@ -1,8 +1,24 @@ #!/bin/bash -e +echo "entrypoint docker: ${@} ${ASSETS_PATH} :: ${@: 1:1} / ${@: 2:1}" + # If running the rails server then create or migrate existing database -if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then +if [ "${@: 1:1}" == "./bin/rails" ] && [ "${@: 2:1}" == "server" ]; then + if [ -f ${INSTALL_DIR}/pids/server.pid ]; then + rm ${INSTALL_DIR}/pids/server.pid + fi + + echo "Prepare db..." ./bin/rails db:prepare + + echo "Copy assets to <$ASSETS_PATH>?" + + if [[ -n "$ASSETS_PATH" ]]; then + echo "Copy assets to $ASSETS_PATH" + find "$INSTALL_DIR/public" -mindepth 1 -exec echo "copy " {} \; + find "$INSTALL_DIR/public" -mindepth 1 -exec cp -a {} "$ASSETS_PATH" \; + fi fi + exec "${@}" diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..964fd9a --- /dev/null +++ b/compose.yml @@ -0,0 +1,59 @@ +# This is available in $COMPOSE_PROJECT_NAME +name: a11yist + +networks: + ingress: + external: true + +services: + app: &app + build: + context: . + target: development + args: + NAME: ${USER} + UID: 1000 + GID: 1000 + INSTALL_DIR: ${PWD} + volumes: + - ${SSH_AUTH_SOCK}:/ssh-agent + - ${PWD}:${PWD} + env_file: + - .env + environment: + APP_HOST: ${COMPOSE_PROJECT_NAME}.localhost + HISTFILE: /app/tmp/.bash_history + IRBRC: /app/.irbrc + LOG_LEVEL: debug + PSQL_HISTORY: /app/tmp/.psql_history + RAILS_ENV: development + RAILS_SERVE_STATIC_FILES: 1 + SELENIUM_REMOTE_URL: http://chrome:4444/wd/hub + SSH_AUTH_SOCK: /ssh-agent + TRUSTED_IP: 172.16.0.0/12,192.168.0.0/16,10.0.0.0/24 + labels: + caddy: "http://${COMPOSE_PROJECT_NAME}.localhost" + caddy.reverse_proxy: "{{upstreams 3000}}" + networks: + - ingress + - default + + edit: + <<: *app + restart: "no" + labels: [] + depends_on: [] + command: [ "hx", "." ] + entrypoint: null + networks: + - default + + chrome: + image: selenium/standalone-chrome + shm_size: 2g + labels: + caddy: "http://browser.${COMPOSE_PROJECT_NAME}.localhost" + caddy.reverse_proxy: "{{upstreams 7900}}" + networks: + - ingress + - default