Skip to content

Commit 3a65878

Browse files
committed
Primeiro commit
0 parents  commit 3a65878

108 files changed

Lines changed: 31224 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# syntax=docker/dockerfile:1
2+
# check=error=true
3+
4+
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
5+
# docker build -t classless_css_local .
6+
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name classless_css_local classless_css_local
7+
8+
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
9+
10+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11+
ARG RUBY_VERSION=3.3.6
12+
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
13+
14+
# Rails app lives here
15+
WORKDIR /rails
16+
17+
# Install base packages
18+
RUN apt-get update -qq && \
19+
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
20+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
21+
22+
# Set production environment
23+
ENV RAILS_ENV="production" \
24+
BUNDLE_DEPLOYMENT="1" \
25+
BUNDLE_PATH="/usr/local/bundle" \
26+
BUNDLE_WITHOUT="development"
27+
28+
# Throw-away build stage to reduce size of final image
29+
FROM base AS build
30+
31+
# Install packages needed to build gems
32+
RUN apt-get update -qq && \
33+
apt-get install --no-install-recommends -y build-essential git pkg-config && \
34+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
35+
36+
# Install application gems
37+
COPY Gemfile Gemfile.lock ./
38+
RUN bundle install && \
39+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
40+
bundle exec bootsnap precompile --gemfile
41+
42+
# Copy application code
43+
COPY . .
44+
45+
# Precompile bootsnap code for faster boot times
46+
RUN bundle exec bootsnap precompile app/ lib/
47+
48+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
49+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
50+
51+
52+
53+
54+
# Final stage for app image
55+
FROM base
56+
57+
# Copy built artifacts: gems, application
58+
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
59+
COPY --from=build /rails /rails
60+
61+
# Run and own only the runtime files as a non-root user for security
62+
RUN groupadd --system --gid 1000 rails && \
63+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
64+
chown -R rails:rails db log storage tmp
65+
USER 1000:1000
66+
67+
# Entrypoint prepares the database.
68+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
69+
70+
# Start server via Thruster by default, this can be overwritten at runtime
71+
EXPOSE 80
72+
CMD ["./bin/thrust", "./bin/rails", "server"]

Gemfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
source "https://rubygems.org"
2+
3+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4+
gem "rails", "~> 8.0.0", ">= 8.0.0.1"
5+
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
6+
gem "propshaft"
7+
# Use sqlite3 as the database for Active Record
8+
gem "sqlite3", ">= 2.1"
9+
# Use the Puma web server [https://github.com/puma/puma]
10+
gem "puma", ">= 5.0"
11+
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
12+
gem "importmap-rails"
13+
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
14+
gem "turbo-rails"
15+
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
16+
gem "stimulus-rails"
17+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
18+
gem "jbuilder"
19+
20+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
21+
# gem "bcrypt", "~> 3.1.7"
22+
23+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
24+
gem "tzinfo-data", platforms: %i[ windows jruby ]
25+
26+
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
27+
gem "solid_cache"
28+
gem "solid_queue"
29+
gem "solid_cable"
30+
31+
# Reduces boot times through caching; required in config/boot.rb
32+
gem "bootsnap", require: false
33+
34+
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
35+
gem "kamal", require: false
36+
37+
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
38+
gem "thruster", require: false
39+
40+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
41+
# gem "image_processing", "~> 1.2"
42+
43+
group :development, :test do
44+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
45+
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
46+
47+
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
48+
gem "brakeman", require: false
49+
50+
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
51+
gem "rubocop-rails-omakase", require: false
52+
end
53+
54+
group :development do
55+
# Use console on exceptions pages [https://github.com/rails/web-console]
56+
gem "web-console"
57+
end
58+
59+
group :test do
60+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
61+
gem "capybara"
62+
gem "selenium-webdriver"
63+
end

0 commit comments

Comments
 (0)