New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails project should run bundle before build image #3024

Closed
chloerei opened this Issue Apr 24, 2017 · 9 comments

Comments

Projects
None yet
3 participants
@chloerei

chloerei commented Apr 24, 2017

File: compose/rails.md, CC @londoncalling

In section "Build the project", if use "--skip-bundle" when create project, Gemfile.lock will be empty. Event if build image in the next step, because volume do not mount in build process, changes in Gemfile.lock will not sync to host. However Gemfile.lock should be check into version control (http://bundler.io/v1.14/man/bundle-install.1.html#THE-GEMFILE-LOCK).

My opinion is do not use "--skip-bundle" when create project:

docker-compose run web rails new . --force --database=postgresql

If edit Gemfile later, we should run bundle first in order to update Gemfile.lock:

docker-compose run web bundle

Then rebuild image:

docker-compose build
@londoncalling

This comment has been minimized.

Show comment
Hide comment
@londoncalling

londoncalling May 18, 2017

Contributor

@chloerei I've run through this quickstart again both ways, from a clean project directory with no other containers or images present at the start of each test:

  • first with commands as shown (using --skip-bundle in the docker-compose run command)
  • then in a new project, leaving off --skip-bundle per your suggestion.

Both work, and in both cases there is content in Gemfile.lock after the first docker-compose run .... The only difference I see is that if I leave off --skip-bundle, the first build goes a little faster.

I did see some clarifications I should add about taking the app down, and finding the web page on Docker for Mac and Windows, so I'll make those changes and link them to this issue, but I don't think the we need to remove --skip-bundle from the command.

Also, the sample works with Compose v.3, so I'll update the example Compose file in the docs.

cc: @shin- @dnephin @nathanleclaire

My test output

For reference, here are results of the first most relevant steps, following the procedure as written, which includes --skip-bundle:

Create files

Create the files per the steps at define the project in the Quickstart: Compose and Rails.

Check Gemfile.lock to show that it is really empty before we start

vmb at snap in ~/sandbox/rails-compose
$ cat Gemfile.lock

Build the project

Run docker-compose run web rails new . --force --database=postgresql --skip-bundle

$ docker-compose run web rails new . --force --database=postgresql --skip-bundle
Creating network "railscompose_default" with the default driver
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
10a267c67f42: Pull complete
e9a920522e33: Pull complete
6888e696bd71: Pull complete
798096eed143: Pull complete
fb58419959b5: Pull complete
97f9ec09cb68: Pull complete
ba9f11a5c9fc: Pull complete
dff989d6d72e: Pull complete
82906cc5619b: Pull complete
e6744ef841db: Pull complete
eea92d4e4b87: Pull complete
4aa1806cedf8: Pull complete
d6537d862689: Pull complete
Digest: sha256:b9fa1cdbe4d3445c08e1496e36a3f18a3cd6d368154ce90469a298a5950a4b69
Status: Downloaded newer image for postgres:latest
Creating railscompose_db_1 ... 
Creating railscompose_db_1 ... done
Building web
Step 1/8 : FROM ruby:2.3.3
2.3.3: Pulling from library/ruby
6d827a3ef358: Pull complete
2726297beaf1: Pull complete
7d27bd3d7fec: Pull complete
44ae682c18a3: Pull complete
59c43fd2bed9: Pull complete
bb4fe7bb11cc: Pull complete
033e9c499340: Pull complete
1cf3484dfbb6: Pull complete
Digest: sha256:fb643a7188c7567d5e32b47d674a32589df86bec769b5fef978951aa3efe994d
Status: Downloaded newer image for ruby:2.3.3
 ---> 0e1db669d557
Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Running in 9378c9947b82
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  dpkg-dev fakeroot libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libc-ares2 libdpkg-perl libfakeroot
  libfile-fcntllock-perl libpq5 libtimedate-perl libv8-3.14.5
Suggested packages:
  debian-keyring postgresql-doc-9.4
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libc-ares2 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libtimedate-perl libv8-3.14.5 nodejs
The following packages will be upgraded:
  libpq-dev libpq5
2 upgraded, 13 newly installed, 0 to remove and 35 not upgraded.
Need to get 5197 kB of archives.
After this operation, 12.5 MB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main libpq-dev amd64 9.4.12-0+deb8u1 [165 kB]
Get:2 http://security.debian.org/ jessie/updates/main libpq5 amd64 9.4.12-0+deb8u1 [126 kB]
Get:3 http://deb.debian.org/debian/ jessie/main libc-ares2 amd64 1.10.0-2+deb8u1 [72.5 kB]
Get:4 http://deb.debian.org/debian/ jessie/main libtimedate-perl all 2.3000-2 [42.2 kB]
Get:5 http://deb.debian.org/debian/ jessie/main libdpkg-perl all 1.17.27 [1075 kB]
Get:6 http://deb.debian.org/debian/ jessie/main dpkg-dev all 1.17.27 [1548 kB]
Get:7 http://deb.debian.org/debian/ jessie/main build-essential amd64 11.7 [7114 B]
Get:8 http://deb.debian.org/debian/ jessie/main libfakeroot amd64 1.20.2-1 [44.7 kB]
Get:9 http://deb.debian.org/debian/ jessie/main fakeroot amd64 1.20.2-1 [84.7 kB]
Get:10 http://deb.debian.org/debian/ jessie/main libalgorithm-diff-perl all 1.19.02-3 [51.7 kB]
Get:11 http://deb.debian.org/debian/ jessie/main libalgorithm-diff-xs-perl amd64 0.04-3+b1 [12.2 kB]
Get:12 http://deb.debian.org/debian/ jessie/main libalgorithm-merge-perl all 0.08-2 [13.5 kB]
Get:13 http://deb.debian.org/debian/ jessie/main libfile-fcntllock-perl amd64 0.22-1+b1 [36.4 kB]
Get:14 http://deb.debian.org/debian/ jessie/main libv8-3.14.5 amd64 3.14.5.8-8.1 [1269 kB]
Get:15 http://deb.debian.org/debian/ jessie/main nodejs amd64 0.10.29~dfsg-2 [648 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 5197 kB in 2s (2413 kB/s)
(Reading database ... 21168 files and directories currently installed.)
Preparing to unpack .../libpq-dev_9.4.12-0+deb8u1_amd64.deb ...
Unpacking libpq-dev (9.4.12-0+deb8u1) over (9.4.10-0+deb8u1) ...
Preparing to unpack .../libpq5_9.4.12-0+deb8u1_amd64.deb ...
Unpacking libpq5:amd64 (9.4.12-0+deb8u1) over (9.4.10-0+deb8u1) ...
Selecting previously unselected package libc-ares2:amd64.
Preparing to unpack .../libc-ares2_1.10.0-2+deb8u1_amd64.deb ...
Unpacking libc-ares2:amd64 (1.10.0-2+deb8u1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../libdpkg-perl_1.17.27_all.deb ...
Unpacking libdpkg-perl (1.17.27) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../dpkg-dev_1.17.27_all.deb ...
Unpacking dpkg-dev (1.17.27) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.7_amd64.deb ...
Unpacking build-essential (11.7) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../libfakeroot_1.20.2-1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.20.2-1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../fakeroot_1.20.2-1_amd64.deb ...
Unpacking fakeroot (1.20.2-1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.02-3) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../libalgorithm-diff-xs-perl_0.04-3+b1_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-3+b1) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../libalgorithm-merge-perl_0.08-2_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-2) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../libfile-fcntllock-perl_0.22-1+b1_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-1+b1) ...
Selecting previously unselected package libv8-3.14.5.
Preparing to unpack .../libv8-3.14.5_3.14.5.8-8.1_amd64.deb ...
Unpacking libv8-3.14.5 (3.14.5.8-8.1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_0.10.29~dfsg-2_amd64.deb ...
Unpacking nodejs (0.10.29~dfsg-2) ...
Setting up libpq5:amd64 (9.4.12-0+deb8u1) ...
Setting up libpq-dev (9.4.12-0+deb8u1) ...
Setting up libc-ares2:amd64 (1.10.0-2+deb8u1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libdpkg-perl (1.17.27) ...
Setting up dpkg-dev (1.17.27) ...
Setting up build-essential (11.7) ...
Setting up libfakeroot:amd64 (1.20.2-1) ...
Setting up fakeroot (1.20.2-1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-3+b1) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
Setting up libfile-fcntllock-perl (0.22-1+b1) ...
Setting up libv8-3.14.5 (3.14.5.8-8.1) ...
Setting up nodejs (0.10.29~dfsg-2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.19-18+deb8u7) ...
 ---> cd9e26202411
Removing intermediate container 9378c9947b82
Step 3/8 : RUN mkdir /myapp
 ---> Running in 17e38dbff8e6
 ---> f1568ab29bba
Removing intermediate container 17e38dbff8e6
Step 4/8 : WORKDIR /myapp
 ---> f9e89880199f
Removing intermediate container 50fad74217ad
Step 5/8 : ADD Gemfile /myapp/Gemfile
 ---> a3d24c2ecb2b
Removing intermediate container 20b7df6ee1fd
Step 6/8 : ADD Gemfile.lock /myapp/Gemfile.lock
 ---> d3b1c82537a7
Removing intermediate container 2201ed8f9882
Step 7/8 : RUN bundle install
 ---> Running in 0a84cd6f3c19
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Installing rake 12.0.0
Installing concurrent-ruby 1.0.5
Installing i18n 0.8.1
Installing minitest 5.10.2
Installing thread_safe 0.3.6
Installing builder 3.2.3
Installing erubis 2.7.0
Installing mini_portile2 2.1.0
Installing rack 2.0.3
Installing nio4r 1.2.1 with native extensions
Installing websocket-extensions 0.1.2
Installing mime-types-data 3.2016.0521
Installing arel 7.1.4
Using bundler 1.14.6
Installing method_source 0.8.2
Installing thor 0.19.4
Installing tzinfo 1.2.3
Installing nokogiri 1.7.2 with native extensions
Installing rack-test 0.6.3
Installing sprockets 3.7.1
Installing websocket-driver 0.6.5 with native extensions
Installing mime-types 3.1
Installing activesupport 5.0.0.1
Installing loofah 2.0.3
Installing mail 2.6.5
Installing rails-dom-testing 2.0.3
Installing globalid 0.4.0
Installing activemodel 5.0.0.1
Installing rails-html-sanitizer 1.0.3
Installing activejob 5.0.0.1
Installing activerecord 5.0.0.1
Installing actionview 5.0.0.1
Installing actionpack 5.0.0.1
Installing actioncable 5.0.0.1
Installing actionmailer 5.0.0.1
Installing railties 5.0.0.1
Installing sprockets-rails 3.2.0
Installing rails 5.0.0.1
Bundle complete! 1 Gemfile dependency, 38 gems now installed.
Bundled gems are installed into /usr/local/bundle.
 ---> c3fd68814880
Removing intermediate container 0a84cd6f3c19
Step 8/8 : ADD . /myapp
 ---> dc7d905c461e
Removing intermediate container 32d12a87edc7
Successfully built dc7d905c461e
Successfully tagged railscompose_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
       exist  
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
       force  Gemfile
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
      remove  config/initializers/cors.rb

List files

$ ls -l
total 56
-rw-r--r--   1 vmb  staff   223 May 18 14:26 Dockerfile
-rw-r--r--   1 vmb  staff  1738 May 18 14:29 Gemfile
-rw-r--r--   1 vmb  staff  2764 May 18 14:29 Gemfile.lock
-rw-r--r--   1 vmb  staff   374 May 18 14:29 README.md
-rw-r--r--   1 vmb  staff   227 May 18 14:29 Rakefile
drwxr-xr-x  10 vmb  staff   340 May 18 14:29 app
drwxr-xr-x   7 vmb  staff   238 May 18 14:29 bin
drwxr-xr-x  14 vmb  staff   476 May 18 14:29 config
-rw-r--r--   1 vmb  staff   130 May 18 14:29 config.ru
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 db
-rw-r--r--   1 vmb  staff   211 May 18 14:27 docker-compose.yml
drwxr-xr-x   4 vmb  staff   136 May 18 14:29 lib
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 log
drwxr-xr-x   9 vmb  staff   306 May 18 14:29 public
drwxr-xr-x   9 vmb  staff   306 May 18 14:29 test
drwxr-xr-x   4 vmb  staff   136 May 18 14:29 tmp
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 vendor

cat Gemfile.lock

vmb at snap in ~/sandbox/rails-compose
$ cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.0.0.1)
      actionpack (= 5.0.0.1)
      nio4r (~> 1.2)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.0.1)
      actionview (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.0.1)
      activesupport (= 5.0.0.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (5.0.0.1)
      activesupport (= 5.0.0.1)
      globalid (>= 0.3.6)
    activemodel (5.0.0.1)
      activesupport (= 5.0.0.1)
    activerecord (5.0.0.1)
      activemodel (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      arel (~> 7.0)
    activesupport (5.0.0.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (7.1.4)
    builder (3.2.3)
    concurrent-ruby (1.0.5)
    erubis (2.7.0)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    i18n (0.8.1)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.5)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.10.2)
    nio4r (1.2.1)
    nokogiri (1.7.2)
      mini_portile2 (~> 2.1.0)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.0.1)
      actioncable (= 5.0.0.1)
      actionmailer (= 5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      activemodel (= 5.0.0.1)
      activerecord (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.0.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.0.0.1)
      actionpack (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  ruby

DEPENDENCIES
  rails (= 5.0.0.1)

BUNDLED WITH
   1.14.6

From here continue with docker-compose build and rest of steps

vicky at snap in ~/sandbox/rails-compose
$ docker-compose build
db uses an image, skipping
Building web
Step 1/8 : FROM ruby:2.3.3
 ---> 0e1db669d557
Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Using cache
 ---> cd9e26202411
. . .
Installing web-console 3.5.1
Installing rails 5.0.0.1
Installing sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 62 gems now installed.
Bundled gems are installed into /usr/local/bundle.
 ---> 27a7861f7101
Removing intermediate container 994aca60315c
Step 8/8 : ADD . /myapp
 ---> 0e8190956241
Removing intermediate container cad2fe295c07
Successfully built 0e8190956241
Successfully tagged railscompose_web:latest
...
Contributor

londoncalling commented May 18, 2017

@chloerei I've run through this quickstart again both ways, from a clean project directory with no other containers or images present at the start of each test:

  • first with commands as shown (using --skip-bundle in the docker-compose run command)
  • then in a new project, leaving off --skip-bundle per your suggestion.

Both work, and in both cases there is content in Gemfile.lock after the first docker-compose run .... The only difference I see is that if I leave off --skip-bundle, the first build goes a little faster.

I did see some clarifications I should add about taking the app down, and finding the web page on Docker for Mac and Windows, so I'll make those changes and link them to this issue, but I don't think the we need to remove --skip-bundle from the command.

Also, the sample works with Compose v.3, so I'll update the example Compose file in the docs.

cc: @shin- @dnephin @nathanleclaire

My test output

For reference, here are results of the first most relevant steps, following the procedure as written, which includes --skip-bundle:

Create files

Create the files per the steps at define the project in the Quickstart: Compose and Rails.

Check Gemfile.lock to show that it is really empty before we start

vmb at snap in ~/sandbox/rails-compose
$ cat Gemfile.lock

Build the project

Run docker-compose run web rails new . --force --database=postgresql --skip-bundle

$ docker-compose run web rails new . --force --database=postgresql --skip-bundle
Creating network "railscompose_default" with the default driver
Pulling db (postgres:latest)...
latest: Pulling from library/postgres
10a267c67f42: Pull complete
e9a920522e33: Pull complete
6888e696bd71: Pull complete
798096eed143: Pull complete
fb58419959b5: Pull complete
97f9ec09cb68: Pull complete
ba9f11a5c9fc: Pull complete
dff989d6d72e: Pull complete
82906cc5619b: Pull complete
e6744ef841db: Pull complete
eea92d4e4b87: Pull complete
4aa1806cedf8: Pull complete
d6537d862689: Pull complete
Digest: sha256:b9fa1cdbe4d3445c08e1496e36a3f18a3cd6d368154ce90469a298a5950a4b69
Status: Downloaded newer image for postgres:latest
Creating railscompose_db_1 ... 
Creating railscompose_db_1 ... done
Building web
Step 1/8 : FROM ruby:2.3.3
2.3.3: Pulling from library/ruby
6d827a3ef358: Pull complete
2726297beaf1: Pull complete
7d27bd3d7fec: Pull complete
44ae682c18a3: Pull complete
59c43fd2bed9: Pull complete
bb4fe7bb11cc: Pull complete
033e9c499340: Pull complete
1cf3484dfbb6: Pull complete
Digest: sha256:fb643a7188c7567d5e32b47d674a32589df86bec769b5fef978951aa3efe994d
Status: Downloaded newer image for ruby:2.3.3
 ---> 0e1db669d557
Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Running in 9378c9947b82
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  dpkg-dev fakeroot libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libc-ares2 libdpkg-perl libfakeroot
  libfile-fcntllock-perl libpq5 libtimedate-perl libv8-3.14.5
Suggested packages:
  debian-keyring postgresql-doc-9.4
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libc-ares2 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libtimedate-perl libv8-3.14.5 nodejs
The following packages will be upgraded:
  libpq-dev libpq5
2 upgraded, 13 newly installed, 0 to remove and 35 not upgraded.
Need to get 5197 kB of archives.
After this operation, 12.5 MB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main libpq-dev amd64 9.4.12-0+deb8u1 [165 kB]
Get:2 http://security.debian.org/ jessie/updates/main libpq5 amd64 9.4.12-0+deb8u1 [126 kB]
Get:3 http://deb.debian.org/debian/ jessie/main libc-ares2 amd64 1.10.0-2+deb8u1 [72.5 kB]
Get:4 http://deb.debian.org/debian/ jessie/main libtimedate-perl all 2.3000-2 [42.2 kB]
Get:5 http://deb.debian.org/debian/ jessie/main libdpkg-perl all 1.17.27 [1075 kB]
Get:6 http://deb.debian.org/debian/ jessie/main dpkg-dev all 1.17.27 [1548 kB]
Get:7 http://deb.debian.org/debian/ jessie/main build-essential amd64 11.7 [7114 B]
Get:8 http://deb.debian.org/debian/ jessie/main libfakeroot amd64 1.20.2-1 [44.7 kB]
Get:9 http://deb.debian.org/debian/ jessie/main fakeroot amd64 1.20.2-1 [84.7 kB]
Get:10 http://deb.debian.org/debian/ jessie/main libalgorithm-diff-perl all 1.19.02-3 [51.7 kB]
Get:11 http://deb.debian.org/debian/ jessie/main libalgorithm-diff-xs-perl amd64 0.04-3+b1 [12.2 kB]
Get:12 http://deb.debian.org/debian/ jessie/main libalgorithm-merge-perl all 0.08-2 [13.5 kB]
Get:13 http://deb.debian.org/debian/ jessie/main libfile-fcntllock-perl amd64 0.22-1+b1 [36.4 kB]
Get:14 http://deb.debian.org/debian/ jessie/main libv8-3.14.5 amd64 3.14.5.8-8.1 [1269 kB]
Get:15 http://deb.debian.org/debian/ jessie/main nodejs amd64 0.10.29~dfsg-2 [648 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 5197 kB in 2s (2413 kB/s)
(Reading database ... 21168 files and directories currently installed.)
Preparing to unpack .../libpq-dev_9.4.12-0+deb8u1_amd64.deb ...
Unpacking libpq-dev (9.4.12-0+deb8u1) over (9.4.10-0+deb8u1) ...
Preparing to unpack .../libpq5_9.4.12-0+deb8u1_amd64.deb ...
Unpacking libpq5:amd64 (9.4.12-0+deb8u1) over (9.4.10-0+deb8u1) ...
Selecting previously unselected package libc-ares2:amd64.
Preparing to unpack .../libc-ares2_1.10.0-2+deb8u1_amd64.deb ...
Unpacking libc-ares2:amd64 (1.10.0-2+deb8u1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../libdpkg-perl_1.17.27_all.deb ...
Unpacking libdpkg-perl (1.17.27) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../dpkg-dev_1.17.27_all.deb ...
Unpacking dpkg-dev (1.17.27) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.7_amd64.deb ...
Unpacking build-essential (11.7) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../libfakeroot_1.20.2-1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.20.2-1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../fakeroot_1.20.2-1_amd64.deb ...
Unpacking fakeroot (1.20.2-1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.02-3) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../libalgorithm-diff-xs-perl_0.04-3+b1_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-3+b1) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../libalgorithm-merge-perl_0.08-2_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-2) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../libfile-fcntllock-perl_0.22-1+b1_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-1+b1) ...
Selecting previously unselected package libv8-3.14.5.
Preparing to unpack .../libv8-3.14.5_3.14.5.8-8.1_amd64.deb ...
Unpacking libv8-3.14.5 (3.14.5.8-8.1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_0.10.29~dfsg-2_amd64.deb ...
Unpacking nodejs (0.10.29~dfsg-2) ...
Setting up libpq5:amd64 (9.4.12-0+deb8u1) ...
Setting up libpq-dev (9.4.12-0+deb8u1) ...
Setting up libc-ares2:amd64 (1.10.0-2+deb8u1) ...
Setting up libtimedate-perl (2.3000-2) ...
Setting up libdpkg-perl (1.17.27) ...
Setting up dpkg-dev (1.17.27) ...
Setting up build-essential (11.7) ...
Setting up libfakeroot:amd64 (1.20.2-1) ...
Setting up fakeroot (1.20.2-1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-3+b1) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
Setting up libfile-fcntllock-perl (0.22-1+b1) ...
Setting up libv8-3.14.5 (3.14.5.8-8.1) ...
Setting up nodejs (0.10.29~dfsg-2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.19-18+deb8u7) ...
 ---> cd9e26202411
Removing intermediate container 9378c9947b82
Step 3/8 : RUN mkdir /myapp
 ---> Running in 17e38dbff8e6
 ---> f1568ab29bba
Removing intermediate container 17e38dbff8e6
Step 4/8 : WORKDIR /myapp
 ---> f9e89880199f
Removing intermediate container 50fad74217ad
Step 5/8 : ADD Gemfile /myapp/Gemfile
 ---> a3d24c2ecb2b
Removing intermediate container 20b7df6ee1fd
Step 6/8 : ADD Gemfile.lock /myapp/Gemfile.lock
 ---> d3b1c82537a7
Removing intermediate container 2201ed8f9882
Step 7/8 : RUN bundle install
 ---> Running in 0a84cd6f3c19
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Installing rake 12.0.0
Installing concurrent-ruby 1.0.5
Installing i18n 0.8.1
Installing minitest 5.10.2
Installing thread_safe 0.3.6
Installing builder 3.2.3
Installing erubis 2.7.0
Installing mini_portile2 2.1.0
Installing rack 2.0.3
Installing nio4r 1.2.1 with native extensions
Installing websocket-extensions 0.1.2
Installing mime-types-data 3.2016.0521
Installing arel 7.1.4
Using bundler 1.14.6
Installing method_source 0.8.2
Installing thor 0.19.4
Installing tzinfo 1.2.3
Installing nokogiri 1.7.2 with native extensions
Installing rack-test 0.6.3
Installing sprockets 3.7.1
Installing websocket-driver 0.6.5 with native extensions
Installing mime-types 3.1
Installing activesupport 5.0.0.1
Installing loofah 2.0.3
Installing mail 2.6.5
Installing rails-dom-testing 2.0.3
Installing globalid 0.4.0
Installing activemodel 5.0.0.1
Installing rails-html-sanitizer 1.0.3
Installing activejob 5.0.0.1
Installing activerecord 5.0.0.1
Installing actionview 5.0.0.1
Installing actionpack 5.0.0.1
Installing actioncable 5.0.0.1
Installing actionmailer 5.0.0.1
Installing railties 5.0.0.1
Installing sprockets-rails 3.2.0
Installing rails 5.0.0.1
Bundle complete! 1 Gemfile dependency, 38 gems now installed.
Bundled gems are installed into /usr/local/bundle.
 ---> c3fd68814880
Removing intermediate container 0a84cd6f3c19
Step 8/8 : ADD . /myapp
 ---> dc7d905c461e
Removing intermediate container 32d12a87edc7
Successfully built dc7d905c461e
Successfully tagged railscompose_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
       exist  
      create  README.md
      create  Rakefile
      create  config.ru
      create  .gitignore
       force  Gemfile
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/assets/javascripts/channels
      create  app/assets/javascripts/channels/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/bundle
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/update
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/secrets.yml
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/test_helper.rb
      create  tmp
      create  tmp/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.keep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.keep
      remove  config/initializers/cors.rb

List files

$ ls -l
total 56
-rw-r--r--   1 vmb  staff   223 May 18 14:26 Dockerfile
-rw-r--r--   1 vmb  staff  1738 May 18 14:29 Gemfile
-rw-r--r--   1 vmb  staff  2764 May 18 14:29 Gemfile.lock
-rw-r--r--   1 vmb  staff   374 May 18 14:29 README.md
-rw-r--r--   1 vmb  staff   227 May 18 14:29 Rakefile
drwxr-xr-x  10 vmb  staff   340 May 18 14:29 app
drwxr-xr-x   7 vmb  staff   238 May 18 14:29 bin
drwxr-xr-x  14 vmb  staff   476 May 18 14:29 config
-rw-r--r--   1 vmb  staff   130 May 18 14:29 config.ru
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 db
-rw-r--r--   1 vmb  staff   211 May 18 14:27 docker-compose.yml
drwxr-xr-x   4 vmb  staff   136 May 18 14:29 lib
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 log
drwxr-xr-x   9 vmb  staff   306 May 18 14:29 public
drwxr-xr-x   9 vmb  staff   306 May 18 14:29 test
drwxr-xr-x   4 vmb  staff   136 May 18 14:29 tmp
drwxr-xr-x   3 vmb  staff   102 May 18 14:29 vendor

cat Gemfile.lock

vmb at snap in ~/sandbox/rails-compose
$ cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.0.0.1)
      actionpack (= 5.0.0.1)
      nio4r (~> 1.2)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.0.1)
      actionview (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.0.1)
      activesupport (= 5.0.0.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (5.0.0.1)
      activesupport (= 5.0.0.1)
      globalid (>= 0.3.6)
    activemodel (5.0.0.1)
      activesupport (= 5.0.0.1)
    activerecord (5.0.0.1)
      activemodel (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      arel (~> 7.0)
    activesupport (5.0.0.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (7.1.4)
    builder (3.2.3)
    concurrent-ruby (1.0.5)
    erubis (2.7.0)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    i18n (0.8.1)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.5)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.10.2)
    nio4r (1.2.1)
    nokogiri (1.7.2)
      mini_portile2 (~> 2.1.0)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.0.1)
      actioncable (= 5.0.0.1)
      actionmailer (= 5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      activemodel (= 5.0.0.1)
      activerecord (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.0.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.0.0.1)
      actionpack (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  ruby

DEPENDENCIES
  rails (= 5.0.0.1)

BUNDLED WITH
   1.14.6

From here continue with docker-compose build and rest of steps

vicky at snap in ~/sandbox/rails-compose
$ docker-compose build
db uses an image, skipping
Building web
Step 1/8 : FROM ruby:2.3.3
 ---> 0e1db669d557
Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Using cache
 ---> cd9e26202411
. . .
Installing web-console 3.5.1
Installing rails 5.0.0.1
Installing sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 62 gems now installed.
Bundled gems are installed into /usr/local/bundle.
 ---> 27a7861f7101
Removing intermediate container 994aca60315c
Step 8/8 : ADD . /myapp
 ---> 0e8190956241
Removing intermediate container cad2fe295c07
Successfully built 0e8190956241
Successfully tagged railscompose_web:latest
...
@chloerei

This comment has been minimized.

Show comment
Hide comment
@chloerei

chloerei May 19, 2017

I found the Gemfile.lock content in your post only have one denpendencies:

DEPENDENCIES
  rails (= 5.0.0.1)

That is base on the initial Gemfile, not create by rails new. In detail, the Gemfile.lock is update when rails command setup, before rails new generate files. So although set --skip-bundle, it still write Gemfile.lock.

But the content in Gemfile.lock is not match the Gemfile generate by rails new, and it will not update by docker-compose build, you can see at the last of your test, Gemfile.lock is same with previous.

Until we run any rails command in container, like docker-compose up, then rails will update and sync Gemfile.lock to host, then it is match current Gemfile.

This behavior is Implicit, and will cause problems in some situations. For example, edit Gemfile, build image, but not run any rails command in container, the Gemfile.lock will not update. Build image on other machine with same source code, it maybe not install same version gems because Gemfile.lock is outdate, and bundle resolve dependencies again.

So I recommend rails new with bundle and run docker-compose run web bundle install after edit Gemfile, explicit update Gemfile.lock.

chloerei commented May 19, 2017

I found the Gemfile.lock content in your post only have one denpendencies:

DEPENDENCIES
  rails (= 5.0.0.1)

That is base on the initial Gemfile, not create by rails new. In detail, the Gemfile.lock is update when rails command setup, before rails new generate files. So although set --skip-bundle, it still write Gemfile.lock.

But the content in Gemfile.lock is not match the Gemfile generate by rails new, and it will not update by docker-compose build, you can see at the last of your test, Gemfile.lock is same with previous.

Until we run any rails command in container, like docker-compose up, then rails will update and sync Gemfile.lock to host, then it is match current Gemfile.

This behavior is Implicit, and will cause problems in some situations. For example, edit Gemfile, build image, but not run any rails command in container, the Gemfile.lock will not update. Build image on other machine with same source code, it maybe not install same version gems because Gemfile.lock is outdate, and bundle resolve dependencies again.

So I recommend rails new with bundle and run docker-compose run web bundle install after edit Gemfile, explicit update Gemfile.lock.

@londoncalling

This comment has been minimized.

Show comment
Hide comment
@londoncalling

londoncalling May 19, 2017

Contributor

Okay @chloerei that makes sense, you are right. When I re-ran that command and left off skip-bundle, the Gemfile.lock showed these dependencies:

DEPENDENCIES
  byebug
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  jquery-rails
  listen (~> 3.0.5)
  pg (~> 0.18)
  puma (~> 3.0)
  rails (~> 5.0.0, >= 5.0.0.1)
  sass-rails (~> 5.0)
  spring
  spring-watcher-listen (~> 2.0.0)
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console

I'm also making changes to this to run it with docker stack deploy per suggestion from @ManoMarks. I'm working on a PR for it that I haven't submitted yet, so it will contain all these changes.

If I understand correctly, then, we'll start with this (leaving off --skip-bundle):

docker-compose run web rails new . --force --database=postgresql 

At the end, when we are explaining steps for edit and rebuild, run:

docker-compose run web bundle install

Then, after that, docker-compose up. Does that sound right?

@ManoMarks @shin- @dnephin feel free to jump in :-)

Contributor

londoncalling commented May 19, 2017

Okay @chloerei that makes sense, you are right. When I re-ran that command and left off skip-bundle, the Gemfile.lock showed these dependencies:

DEPENDENCIES
  byebug
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  jquery-rails
  listen (~> 3.0.5)
  pg (~> 0.18)
  puma (~> 3.0)
  rails (~> 5.0.0, >= 5.0.0.1)
  sass-rails (~> 5.0)
  spring
  spring-watcher-listen (~> 2.0.0)
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console

I'm also making changes to this to run it with docker stack deploy per suggestion from @ManoMarks. I'm working on a PR for it that I haven't submitted yet, so it will contain all these changes.

If I understand correctly, then, we'll start with this (leaving off --skip-bundle):

docker-compose run web rails new . --force --database=postgresql 

At the end, when we are explaining steps for edit and rebuild, run:

docker-compose run web bundle install

Then, after that, docker-compose up. Does that sound right?

@ManoMarks @shin- @dnephin feel free to jump in :-)

@chloerei

This comment has been minimized.

Show comment
Hide comment
@chloerei

chloerei May 19, 2017

After (1)

docker-compose run web bundle install

Should run (2)

docker-compose build

Then (3)

docker-compose up

Because (1) update Gemfile.lock to host, but do not install gems in image. If skip to (3), it will raise Bundler::GemNotFound.

chloerei commented May 19, 2017

After (1)

docker-compose run web bundle install

Should run (2)

docker-compose build

Then (3)

docker-compose up

Because (1) update Gemfile.lock to host, but do not install gems in image. If skip to (3), it will raise Bundler::GemNotFound.

@chloerei

This comment has been minimized.

Show comment
Hide comment
@chloerei

chloerei May 19, 2017

And (3) is not necessary step for edit and rebuild, but it should run after rebuild.

chloerei commented May 19, 2017

And (3) is not necessary step for edit and rebuild, but it should run after rebuild.

@dnephin

This comment has been minimized.

Show comment
Hide comment
@dnephin

dnephin May 19, 2017

Contributor

I believe the example uses mounts, so you don't actually need to rebuild, unless the mounts aren't working for some reason.

You can use docker-compose --build up instead of a separate build then up.

I don't think it's strictly necessary to rebuild, but I guess we could add it, if we explain what it's done.

Contributor

dnephin commented May 19, 2017

I believe the example uses mounts, so you don't actually need to rebuild, unless the mounts aren't working for some reason.

You can use docker-compose --build up instead of a separate build then up.

I don't think it's strictly necessary to rebuild, but I guess we could add it, if we explain what it's done.

@londoncalling

This comment has been minimized.

Show comment
Hide comment
@londoncalling

londoncalling May 19, 2017

Contributor

@dnephin thanks, yes the example totally works. I was just thinking that if for some reason they wanted to make a change to base code, then they would need to re-build, and it would be nice to show how to do that.

Contributor

londoncalling commented May 19, 2017

@dnephin thanks, yes the example totally works. I was just thinking that if for some reason they wanted to make a change to base code, then they would need to re-build, and it would be nice to show how to do that.

@chloerei

This comment has been minimized.

Show comment
Hide comment
@chloerei

chloerei May 19, 2017

To clarify, I say:

Until we run any rails command in container, like docker-compose up, then rails will update and sync Gemfile.lock to host, then it is match current Gemfile.

Do not mean docker-compose up is a necessary step for rebuild, it means who finished the tutorial will accident get a correct Gemfile.lock, but will found problem after edit Gemfile.

docker-compose up --build looks good, I didn‘t know before. 👍

chloerei commented May 19, 2017

To clarify, I say:

Until we run any rails command in container, like docker-compose up, then rails will update and sync Gemfile.lock to host, then it is match current Gemfile.

Do not mean docker-compose up is a necessary step for rebuild, it means who finished the tutorial will accident get a correct Gemfile.lock, but will found problem after edit Gemfile.

docker-compose up --build looks good, I didn‘t know before. 👍

@londoncalling

This comment has been minimized.

Show comment
Hide comment
@londoncalling

londoncalling May 20, 2017

Contributor

@chloerei thanks! I'll ping you on Monday or so with the PR. Great feedback.

Contributor

londoncalling commented May 20, 2017

@chloerei thanks! I'll ping you on Monday or so with the PR. Great feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment