0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

世界最速で rails new したい

Last updated at Posted at 2025-04-21

はじめに

新規プロダクト開発の際「とにかくrails newで雛形を作りたい、下準備とか何もやりたくない」というのは、稀に良くあると思います。

その際は以下のコマンドで一発okです
※オプションは適宜編集してください

docker run -it --rm \
  -e HOME=/rails \
  -v $(pwd):/rails \
  -w /rails \
  --entrypoint /bin/bash \
  ruby:3.4 \
    -c "gem install rails && \
        rails new screening --database=mysql \
              --skip-action-mailbox \
              --skip-action-text \
              --skip-active-storage \
              --skip-action-cable \
              --skip-hotwire \
              --skip-jbuilder \
              --skip-test \
              --skip-system-test \
              --skip-thruster \
              --skip-ci \
              --skip-kamal \
              --skip-solid \
              --skip-bundle"

カレントディレクトリをマウントしているので、ホストマシンに雛形ができているはずです。

複雑なことをやる場合は、一度containerに入ってからコマンドを打てばok牧場です。

docker run -it --rm \
  -e HOME=/rails \
  -v $(pwd):/rails \
  -w /rails \
  ruby:3.4 /bin/bash

gem install rails && \
rails new screening --database=mysql \
                    --skip-action-mailbox \
                    --skip-action-text \
                    --skip-active-storage \
                    --skip-action-cable \
                    --skip-hotwire \
                    --skip-jbuilder \
                    --skip-test \
                    --skip-system-test \
                    --skip-thruster \
                    --skip-ci \
                    --skip-kamal \
                    --skip-solid \
                    --skip-bundle

全てのエンジニアに幸あれ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?