Skip to content

Commit

Permalink
Rails 7.1 にアップグレードした
Browse files Browse the repository at this point in the history
  • Loading branch information
miminashi committed Aug 10, 2024
1 parent 8c1d93b commit e8efa1d
Show file tree
Hide file tree
Showing 20 changed files with 684 additions and 259 deletions.
50 changes: 42 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#
# Stage for builder base
#
FROM ruby:3.1.4-slim-bookworm
# ベースステージ
FROM ruby:3.1.4-slim-bookworm AS base

ENV DEBIAN_FRONTEND noninteractive
ENV APPROOT="/opt/app"
ENV RAILS_LOG_TO_STDOUT="1"
ENV RAILS_ENV="development"

RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get -y install build-essential libpq-dev libpq5 libvips42 curl ffmpeg && \
apt-get clean
apt-get -y install --no-install-recommends build-essential libpq-dev libpq5 libvips42 curl ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN curl -L -O https://github.com/yt-dlp/yt-dlp/releases/download/2023.07.06/yt-dlp_linux && \
RUN curl -L -O https://github.com/yt-dlp/yt-dlp/releases/download/2024.08.06/yt-dlp_linux && \
mv yt-dlp_linux yt-dlp && \
chmod +x yt-dlp && \
mv yt-dlp /usr/local/bin/yt-dlp
Expand All @@ -23,6 +21,42 @@ WORKDIR ${APPROOT}
COPY Gemfile ${APPROOT}
COPY Gemfile.lock ${APPROOT}

# テスト用のステージ
FROM base AS test
RUN apt-get update && \
apt-get install -y wget gnupg --no-install-recommends && \
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' && \
apt-get update && apt-get install -y google-chrome-stable --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
ENV RAILS_ENV="test"
RUN gem install bundler && bundle install
CMD rails about


# 開発用のステージ
FROM base AS development
ENV RAILS_ENV="development"
RUN gem install bundler && bundle install
CMD rails about

# ビルド用のステージ
FROM base AS build
ENV RAILS_ENV="production"
ARG REDIS_URL
RUN gem install bundler && bundle install --without development test
COPY . ${APPROOT}
RUN SECRET_KEY_BASE=$(rails secret) rails assets:precompile

# 本番用のステージ
FROM ruby:3.1.4-slim-bookworm AS production
ENV APPROOT="/opt/app"
ENV RAILS_ENV="production"
ENV RAILS_LOG_TO_STDOUT="1"
ARG REDIS_URL
WORKDIR ${APPROOT}
COPY --from=build ${APPROOT} ${APPROOT}
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /usr/local/bin/yt-dlp /usr/local/bin/yt-dlp
RUN apt-get update && apt-get -y --no-install-recommends install libpq5 ffmpeg libvips42 && apt-get clean && rm -rf /var/lib/apt/lists/*
CMD rails about
31 changes: 0 additions & 31 deletions Dockerfile.production

This file was deleted.

7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.4"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "7.0.4.3"
gem "rails", "7.1"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
Expand All @@ -13,7 +13,7 @@ gem "sprockets-rails"
gem "pg", "~> 1.1"

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

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
Expand Down Expand Up @@ -72,6 +72,5 @@ end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
gem "cuprite"
end
Loading

0 comments on commit e8efa1d

Please sign in to comment.