Skip to content

Commit

Permalink
linkarooie changes
Browse files Browse the repository at this point in the history
  • Loading branch information
loftwah committed Aug 2, 2024
1 parent 3490fab commit 8fbb3e5
Show file tree
Hide file tree
Showing 425 changed files with 3,383 additions and 102,168 deletions.
1 change: 0 additions & 1 deletion .browserslistrc

This file was deleted.

37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.

# Ignore git directory.
/.git/

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all default key files.
/config/master.key
/config/credentials/*.key

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/.keep

# Ignore assets.
/node_modules/
/app/assets/builds/*
!/app/assets/builds/.keep
/public/assets
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ db/schema.rb linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/main.yml

This file was deleted.

28 changes: 16 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

# Ignore bundler config.
/.bundle
node_modules/

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all logfiles and tempfiles.
/log/*
Expand All @@ -18,7 +23,7 @@
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
Expand All @@ -30,14 +35,13 @@
# Ignore master key for decrypting credentials and more.
/config/master.key

.env
*.sqlite3
db/development.sqlite3

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
.Zone.Identifier
/app/assets/builds/*
!/app/assets/builds/.keep

# Vite Ruby
/public/vite*
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

1 change: 0 additions & 1 deletion .rspec

This file was deleted.

76 changes: 55 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,66 @@
# Use the official Ruby 3.2.2 image
FROM ruby:3.2.2
# syntax = docker/dockerfile:1

# Add NodeSource as a trusted source of Node.js packages
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base

# Install Node.js and npm
RUN apt-get install nodejs npm -y
# Rails app lives here
WORKDIR /rails

# Optionally, install Yarn (recommended for Rails asset management)
RUN npm install --global yarn
# Set production environment
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development test"

# Set an environment variable to store where the app is installed to inside of the Docker image
ENV INSTALL_PATH /app
# Throw-away build stage to reduce size of final image
FROM base as build

# Create the directory and set it as the working directory
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
# Install packages needed to build gems and node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential git libvips pkg-config nodejs npm

# Use Bundler to bundle install the Ruby gems
# This step is done separately from adding the entire codebase to cache the Docker layer
# Install application gems
COPY Gemfile Gemfile.lock ./
RUN bundle install
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Copy over your application code
# Copy application code
COPY . .

# Expose the port
EXPOSE 3000
# Install JavaScript dependencies
RUN npm install

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl libsqlite3-0 libvips && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# The command that starts your application
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
# Copy built artifacts: gems, application, and node modules
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails

# Ensure required directories exist and have the correct permissions
RUN mkdir -p public/assets public/packs && \
useradd rails --create-home --shell /bin/bash && \
chown -R rails:rails db log storage tmp public/assets public/packs

# Run and own only the runtime files as a non-root user for security
USER rails:rails

# Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
41 changes: 15 additions & 26 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.2"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.7"
gem "rails", "~> 7.1.3", ">= 7.1.3.4"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
# Use sqlite3 as the database for Development
gem 'sqlite3', '~> 1.4'
# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
gem "puma", ">= 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
Expand All @@ -26,19 +23,19 @@ gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
gem "tailwindcss-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

gem 'devise'
gem 'bootstrap', '~> 5.0', '>= 5.0.2'
gem 'sassc'
gem 'webpacker', '~> 5.x'
gem 'aws-sdk', '~> 3'
gem 'rqrcode'
gem 'acts_as_list'

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"
gem "redis", ">= 4.0.1"

gem "devise"
gem "mailcatcher"
gem "font-awesome-sass", "~> 6.5.2"
gem "vite_rails"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
Expand All @@ -47,22 +44,17 @@ gem 'acts_as_list'
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "tzinfo-data", platforms: %i[ windows jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem 'rspec-rails', '~> 5.0'
gem 'factory_bot_rails'
gem "debug", platforms: %i[ mri windows ]
end

group :development do
Expand All @@ -80,7 +72,4 @@ group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end

gem "dotenv-rails", "~> 2.8"
Loading

0 comments on commit 8fbb3e5

Please sign in to comment.