ドッカーの作成(ドッカーのバージョン1.12.5、ビルド7392c3b /ドッカーの作成1.9.0、ビルド2585387)を使用して、かなり標準的なレール(5.0.1)プロジェクトを持っています。環境。残念なことに、Railsがすべてのリロード時にクラスをリロードする通常の開発モードは機能していないようです。代わりに、私のコーディングのサイクルとなっています:コンテナを再構築して再起動する必要があります。ブラウザからリロードできない
- ^C
docker-compose up
docker-compose build
docker-compose up
- のうち泡、すすぎ、私はいくつかのサービスは、すべての時間を実行しているので
を繰り返し私はdocker-compose up
のうちCを強制して、世界を再構築して再起動すると時間がかかり、私のPostgres(データベース)インスタンスを 頭。
ビューファイルを変更して変更をすぐに確認できるので、アプリケーションのマウントが正常に機能していることは明らかです。しかし、クラスをに変更すると、私は強制的にキャンセル - コンパイル - 再開のダンスをします。
ドッキングウィンドウ-compose.yml
services:
app:
env_file:
- .env
depends_on:
- database
- redis
build:
context: .
args:
- environment
command: bin/rails server --port 3000 --binding 0.0.0.0
environment:
REDIS_URL: "redis://redis:6379/0"
links:
- database
- redis
network_mode: bridge
ports:
- "3000:3000"
expose:
- 3000
volumes:
- .:/app:rw
Dockerfile
# https://hub.docker.com/_/ruby/
FROM ruby:2.3-slim
# Install apt based dependencies required to run Rails as
# well as RubyGems. As the Ruby image itself is based on a
# Debian image, we use apt-get to install those.
# nodejs for JavaScript runtime
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends build-essential libpq-dev nodejs git && \
rm -rf /var/lib/apt/lists/* && \
echo "linux up-to-date"
# Configure the main working directory. This is the base
# directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
RUN mkdir /app
WORKDIR /app
# build args, provided --build-arg
ARG environment=production
ARG GIT_COMMIT=unknown
ARG VERSION=unknown
# May be overridden by docker-compose.yml
ENV RAILS_ENV=$environment RACK_ENV=$environment NODE_ENV=$environment
# Copy the Gemfile as well as the Gemfile.lock and install
# the RubyGems. This is a separate step so the dependencies
# will be cached unless changes to one of those two files
# are made.
COPY Gemfile Gemfile.lock ./
RUN gem install bundler && bundle install --jobs 20 --retry 5
# Copy the main application.
COPY . ./
# Precompile Rails assets
RUN bundle exec rake assets:precompile
# Start console (starting puma creates a .pid file that we don't want)
CMD bundle exec rails console
おそらくこれも、https://github.com/rails/rails/issues/16678#issuecomment-113058925 –