diff --git a/.dockerignore b/.dockerignore index 6b8710a..290770f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,13 @@ .git + +cdk/ +copilot/ +kubernetes/ +buildspec* + +docker-compose* +Dockerfile* + +ecs-params* + +README.md diff --git a/Dockerfile b/Dockerfile index f294826..128f524 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,49 @@ -# FROM ruby:2.5-slim -FROM public.ecr.aws/bitnami/ruby:2.5 +FROM public.ecr.aws/docker/library/ruby:3.3-bookworm AS base -COPY Gemfile Gemfile.lock /usr/src/app/ -WORKDIR /usr/src/app +WORKDIR /app -RUN apt-get update && apt-get -y install iproute2 curl jq libgmp3-dev ruby-dev build-essential sqlite libsqlite3-dev python3 python3-pip && \ - gem install bundler:1.17.3 && \ - bundle install && \ - pip3 install awscli netaddr && \ - apt-get autoremove -y --purge && \ - apt-get remove -y --auto-remove --purge ruby-dev libgmp3-dev build-essential libsqlite3-dev && \ - apt-get clean && \ - rm -rvf /root/* /root/.gem* /var/cache/* +COPY Gemfile Gemfile.lock ./ +RUN bundle install --jobs=10 -COPY . /usr/src/app -RUN chmod +x /usr/src/app/startup-cdk.sh +COPY . . -# helpful when trying to update gems -> bundle update, remove the Gemfile.lock, start ruby -# RUN bundle update -# RUN rm -vf /usr/src/app/Gemfile.lock +########################################################################## + +FROM public.ecr.aws/docker/library/ruby:3.3-slim-bookworm + +COPY --from=base /usr/local/bundle /usr/local/bundle +COPY --from=base /app /app + +RUN echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-docker \ + && echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker \ + && apt update \ + && apt upgrade -y \ + && apt install -y \ + iproute2 \ + curl \ + jq \ + unzip \ + && curl https://bun.sh/install | bash \ + && cd /tmp \ + && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ + && unzip awscliv2.zip \ + && ./aws/install \ + && rm -rf /tmp/* \ + && apt purge --autoremove -y \ + unzip \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* + +ENV BUN_INSTALL="/root/.bun" +ENV PATH="$BUN_INSTALL/bin:$PATH" + +WORKDIR /app + +ENV RAILS_ENV=production +RUN rails credentials:edit \ + && rake assets:precompile HEALTHCHECK --interval=10s --timeout=3s \ CMD curl -f -s http://localhost:3000/health/ || exit 1 EXPOSE 3000 -ENTRYPOINT ["bash","/usr/src/app/startup-cdk.sh"] +ENTRYPOINT ["bash","/app/startup-cdk.sh"] diff --git a/Dockerfile.cdk b/Dockerfile.cdk index e184438..ffb6c5f 100644 --- a/Dockerfile.cdk +++ b/Dockerfile.cdk @@ -1,24 +1,44 @@ -FROM ruby:2.5-slim +FROM public.ecr.aws/docker/library/ruby:3.3-bookworm AS base -COPY Gemfile Gemfile.lock /usr/src/app/ -WORKDIR /usr/src/app +WORKDIR /app -RUN apt-get update && apt-get -y install iproute2 curl jq libgmp3-dev ruby-dev build-essential sqlite libsqlite3-dev python3 python3-pip && \ - bundle install && \ - pip3 install awscli && \ - apt-get autoremove -y --purge && \ - apt-get remove -y --auto-remove --purge ruby-dev libgmp3-dev build-essential libsqlite3-dev && \ - apt-get clean && \ - rm -rvf /root/* /root/.gem* /var/cache/* +COPY Gemfile Gemfile.lock ./ +RUN bundle install --jobs=10 -COPY . /usr/src/app -RUN chmod +x /usr/src/app/startup-cdk.sh +COPY . . -# helpful when trying to update gems -> bundle update, remove the Gemfile.lock, start ruby -# RUN bundle update -# RUN rm -vf /usr/src/app/Gemfile.lock +########################################################################## + +FROM public.ecr.aws/docker/library/ruby:3.3-slim-bookworm + +COPY --from=base /usr/local/bundle /usr/local/bundle +COPY --from=base /app /app + +RUN echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-docker \ + && echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker \ + && apt update \ + && apt upgrade -y \ + && apt install -y \ + iproute2 \ + curl \ + jq \ + unzip \ + && curl https://bun.sh/install | bash \ + && apt purge --autoremove -y \ + unzip \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* + +ENV BUN_INSTALL="/root/.bun" +ENV PATH="$BUN_INSTALL/bin:$PATH" + +WORKDIR /app + +ENV RAILS_ENV=production +RUN rails credentials:edit \ + && rake assets:precompile HEALTHCHECK --interval=10s --timeout=3s \ CMD curl -f -s http://localhost:3000/health/ || exit 1 EXPOSE 3000 -ENTRYPOINT ["bash","/usr/src/app/startup-cdk.sh"] +ENTRYPOINT ["bash","/app/startup-cdk.sh"] diff --git a/Gemfile b/Gemfile index 729fda1..0eda67a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,17 +2,18 @@ source 'https://rubygems.org' gem 'thin' +gem 'ostruct' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.10' +gem 'rails', '~> 7.2' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' +gem 'sass-rails', '~> 6.0' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier', '~> 4.0' # Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.1.0' +gem 'coffee-rails', '~> 5.0' # See https://github.com/rails/execjs#readme for more supported runtimes gem 'therubyracer', platforms: :ruby @@ -25,7 +26,7 @@ gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc +gem 'sdoc', '~> 2.0', group: :doc # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' @@ -43,7 +44,7 @@ end group :development do # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 2.0' + gem 'web-console', '~> 4.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' diff --git a/Gemfile.lock b/Gemfile.lock index 4061da4..8d48da5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,182 +1,305 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.10) - actionview (= 4.2.10) - activesupport (= 4.2.10) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.10) - activesupport (= 4.2.10) + actioncable (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) + actionmailer (7.2.1) + actionpack (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.1) + actionview (= 7.2.1) + activesupport (= 7.2.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.1) + actionpack (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.1) + activesupport (= 7.2.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.10) - activesupport (= 4.2.10) - globalid (>= 0.3.0) - activemodel (4.2.10) - activesupport (= 4.2.10) - builder (~> 3.1) - activerecord (4.2.10) - activemodel (= 4.2.10) - activesupport (= 4.2.10) - arel (~> 6.0) - activesupport (4.2.10) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - arel (6.0.4) - binding_of_caller (0.8.0) - debug_inspector (>= 0.0.1) - builder (3.2.3) - byebug (11.0.1) - coffee-rails (4.1.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.1) + activesupport (= 7.2.1) + globalid (>= 0.3.6) + activemodel (7.2.1) + activesupport (= 7.2.1) + activerecord (7.2.1) + activemodel (= 7.2.1) + activesupport (= 7.2.1) + timeout (>= 0.4.0) + activestorage (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activesupport (= 7.2.1) + marcel (~> 1.0) + activesupport (7.2.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + base64 (0.2.0) + bigdecimal (3.1.8) + bindex (0.8.1) + builder (3.3.0) + byebug (11.1.3) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) - crass (1.0.5) - daemons (1.3.1) - debug_inspector (0.0.3) - erubis (2.7.0) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + crass (1.0.6) + daemons (1.4.1) + date (3.3.4) + drb (2.2.1) + erubi (1.13.0) eventmachine (1.2.7) - execjs (2.7.0) - ffi (1.11.1) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (0.9.5) + execjs (2.9.1) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-aarch64-linux-musl) + ffi (1.17.0-arm-linux-gnu) + ffi (1.17.0-arm-linux-musl) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86-linux-gnu) + ffi (1.17.0-x86-linux-musl) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.0-x86_64-linux-musl) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (4.3.5) + io-console (0.7.2) + irb (1.14.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jbuilder (2.13.0) + actionview (>= 5.0.0) + activesupport (>= 5.0.0) + jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.6) - libv8 (3.16.14.19) - loofah (2.3.1) + libv8 (3.16.14.19.1) + libv8 (3.16.14.19.1-arm-linux) + libv8 (3.16.14.19.1-armv7l-linux) + libv8 (3.16.14.19.1-universal-darwin) + libv8 (3.16.14.19.1-x86-linux) + libv8 (3.16.14.19.1-x86_64-darwin) + libv8 (3.16.14.19.1-x86_64-linux) + logger (1.6.1) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - mini_mime (1.0.2) - mini_portile2 (2.5.0) - minitest (5.11.3) - nokogiri (1.11.2) - mini_portile2 (~> 2.5.0) + net-imap + net-pop + net-smtp + marcel (1.0.4) + mini_mime (1.1.5) + minitest (5.25.1) + net-imap (0.4.16) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.3) + nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) - racc (1.5.2) - rack (1.6.13) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.10) - actionmailer (= 4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) - activemodel (= 4.2.10) - activerecord (= 4.2.10) - activesupport (= 4.2.10) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.10) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) - railties (4.2.10) - actionpack (= 4.2.10) - activesupport (= 4.2.10) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.3) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) - ffi (~> 1.0) - rdoc (4.3.0) + nokogiri (1.16.7-arm-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86-linux) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-linux) + racc (~> 1.4) + ostruct (0.6.0) + psych (5.1.2) + stringio + racc (1.8.1) + rack (2.2.9) + rack-session (1.0.2) + rack (< 3) + rack-test (2.1.0) + rack (>= 1.3) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.2.1) + actioncable (= 7.2.1) + actionmailbox (= 7.2.1) + actionmailer (= 7.2.1) + actionpack (= 7.2.1) + actiontext (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activemodel (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + bundler (>= 1.15.0) + railties (= 7.2.1) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.2.1) + rdoc (6.7.0) + psych (>= 4.0.0) ref (2.0.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (0.4.2) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - spring (2.1.0) - sprockets (3.7.2) + reline (0.5.10) + io-console (~> 0.5) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sdoc (2.6.1) + rdoc (>= 5.0) + securerandom (0.3.1) + spring (4.2.1) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.3.13) + sqlite3 (2.1.0-aarch64-linux-gnu) + sqlite3 (2.1.0-aarch64-linux-musl) + sqlite3 (2.1.0-arm-linux-gnu) + sqlite3 (2.1.0-arm-linux-musl) + sqlite3 (2.1.0-arm64-darwin) + sqlite3 (2.1.0-x86-linux-gnu) + sqlite3 (2.1.0-x86-linux-musl) + sqlite3 (2.1.0-x86_64-darwin) + sqlite3 (2.1.0-x86_64-linux-gnu) + sqlite3 (2.1.0-x86_64-linux-musl) + stringio (3.1.1) therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref - thin (1.7.2) + thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.20.3) - thread_safe (0.3.6) - tilt (2.0.9) - turbolinks (5.2.0) + thor (1.3.2) + tilt (2.4.0) + timeout (0.4.1) + turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.5) - thread_safe (~> 0.1) - uglifier (4.1.20) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) - web-console (2.3.0) - activemodel (>= 4.0) - binding_of_caller (>= 0.7.2) - railties (>= 4.0) - sprockets-rails (>= 2.0, < 4.0) + useragent (0.16.10) + web-console (4.2.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + webrick (1.8.2) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) PLATFORMS - ruby + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux + arm-linux-gnu + arm-linux-musl + arm64-darwin + armv7l-linux + universal-darwin + x86-linux + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES activesupport byebug - coffee-rails (~> 4.1.0) + coffee-rails (~> 5.0) jbuilder (~> 2.0) jquery-rails - rails (= 4.2.10) - sass-rails (~> 5.0) - sdoc (~> 0.4.0) + ostruct + rails (~> 7.2) + sass-rails (~> 6.0) + sdoc (~> 2.0) spring sqlite3 therubyracer thin turbolinks - uglifier (>= 1.3.0) - web-console (~> 2.0) + uglifier (~> 4.0) + web-console (~> 4.0) BUNDLED WITH - 1.17.3 + 2.5.16 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..b16e53d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/images/.keep b/app/assets/images/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/assets/images/amazon-ecs-color-icon.png b/app/assets/images/amazon-ecs-color-icon.png new file mode 100644 index 0000000..a2ac24f Binary files /dev/null and b/app/assets/images/amazon-ecs-color-icon.png differ diff --git a/app/views/application/index.html.erb b/app/views/application/index.html.erb index f0b1b47..43c6f00 100644 --- a/app/views/application/index.html.erb +++ b/app/views/application/index.html.erb @@ -1,12 +1,19 @@ -