Skip to content

Commit

Permalink
Merge pull request #66 from miminashi/65-remove-serverpid
Browse files Browse the repository at this point in the history
Rails 7.1 にアップグレードした
  • Loading branch information
miminashi authored Aug 11, 2024
2 parents 3ab408c + 4481209 commit 99535b4
Show file tree
Hide file tree
Showing 31 changed files with 988 additions and 343 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: PreCompile assets
run: ./rails assets:precompile RAILS_ENV=test
run: ./docker_compose --profile test run --rm --build test rails assets:precompile
- name: Create database
run: ./rails db:create
run: ./docker_compose --profile test run --rm --build test rails db:create
- name: Run tests on docker compose
run: ./rails test
run: ./docker_compose --profile test run --rm --build test rails test:system
- name: Upload Logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: log
path: log/test.log
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.

9 changes: 4 additions & 5 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 @@ -49,7 +49,7 @@ gem "bootsnap", require: false
gem "image_processing", "~> 1.2"

# for background jobs
gem "resque"
gem "solid_queue"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
Expand All @@ -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 99535b4

Please sign in to comment.