Apress / deploying-rails-w-docker

Source code for 'Deploying Rails with Docker, Kubernetes and ECS' by Pablo Acuña
http://www.apress.com/9781484224144
Other
13 stars 8 forks source link

docker-compose build fails #1

Open bparanj opened 7 years ago

bparanj commented 7 years ago
postgres_data uses an image, skipping
postgres uses an image, skipping
Building webapp_setup
Step 1/17 : FROM phusion/passenger-ruby23:0.9.19
0.9.19: Pulling from phusion/passenger-ruby23
f069f1d21059: Pull complete
ecbeec5633cf: Pull complete
ea6f18256d63: Pull complete
54bde7b02897: Pull complete
a3ed95caeb02: Pull complete
ce9e695a6234: Pull complete
346026b9659b: Pull complete
ffaf5356e027: Pull complete
85417a8aee4f: Pull complete
Digest: sha256:43c61dde20e05146d1866e161a95617976b4eb085e0978d1407516a067ef9fc7
Status: Downloaded newer image for phusion/passenger-ruby23:0.9.19
 ---> 6841e494987f
Step 2/17 : ENV HOME /root
 ---> Running in 86f5cb4dcf59
 ---> 3ac4f8b2524c
Removing intermediate container 86f5cb4dcf59
Step 3/17 : CMD /sbin/my_init
 ---> Running in 267d1a5f3734
 ---> 3e60612cc89c
Removing intermediate container 267d1a5f3734
Step 4/17 : RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" netcat
 ---> Running in 6277124bff80
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main Sources [1103 kB]
Ign:5 https://oss-binaries.phusionpassenger.com/apt/passenger xenial InRelease
Get:6 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [5179 B]
Get:7 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:8 https://oss-binaries.phusionpassenger.com/apt/passenger xenial Release [23.1 kB]
Get:9 https://oss-binaries.phusionpassenger.com/apt/passenger xenial Release.gpg [819 B]
Get:10 https://oss-binaries.phusionpassenger.com/apt/passenger xenial/main amd64 Packages [18.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [304 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [3202 B]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [188 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [663 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.2 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [579 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-security/main Sources [82.2 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources [2779 B]
Get:22 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources [29.7 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-security/multiverse Sources [1083 B]
Get:24 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [318 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.8 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [133 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2936 B]
Fetched 25.1 MB in 9s (2707 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  netcat-traditional
The following NEW packages will be installed:
  netcat netcat-traditional
0 upgraded, 2 newly installed, 0 to remove and 114 not upgraded.
Need to get 64.1 kB of archives.
After this operation, 191 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 netcat-traditional amd64 1.10-41 [60.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/universe amd64 netcat all 1.10-41 [3438 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 64.1 kB in 0s (86.7 kB/s)
Selecting previously unselected package netcat-traditional.
(Reading database ... 19257 files and directories currently installed.)
Preparing to unpack .../netcat-traditional_1.10-41_amd64.deb ...
Unpacking netcat-traditional (1.10-41) ...
Selecting previously unselected package netcat.
Preparing to unpack .../netcat_1.10-41_all.deb ...
Unpacking netcat (1.10-41) ...
Setting up netcat-traditional (1.10-41) ...
update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/nc.1.gz because associated file /usr/share/man/man1/nc.traditional.1.gz (of link group nc) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/netcat.1.gz because associated file /usr/share/man/man1/nc.traditional.1.gz (of link group nc) doesn't exist
Setting up netcat (1.10-41) ...
 ---> 6a925ea23b1e
Removing intermediate container 6277124bff80
Step 5/17 : RUN rm -f /etc/service/nginx/down
 ---> Running in 422d31fc1b40
 ---> beacc7bed5e8
Removing intermediate container 422d31fc1b40
Step 6/17 : RUN rm /etc/nginx/sites-enabled/default
 ---> Running in 442d0fc2ba43
 ---> b93c9b3bd464
Removing intermediate container 442d0fc2ba43
Step 7/17 : ADD webapp.conf /etc/nginx/sites-enabled/webapp.conf
 ---> e98f4aa2fabb
Removing intermediate container 4ce121f2b920
Step 8/17 : ADD rails-env.conf /etc/nginx/main.d/rails-env.conf
 ---> f232cb26f644
Removing intermediate container 791ab0f49fa8
Step 9/17 : ADD Gemfile /tmp/
 ---> d617f53715b8
Removing intermediate container ecfeceea40fc
Step 10/17 : ADD Gemfile.lock /tmp/
 ---> 7cedd88c8262
Removing intermediate container af9254f07d4a
Step 11/17 : RUN bundle install
 ---> Running in bb5e16e8d744
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Could not locate Gemfile or .bundle/ directory
ERROR: Service 'webapp_setup' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 10 
pacuna commented 7 years ago

hi @bparanj , sorry for the delay. I just ran docker-compose build on a fresh clone of the repo and everything worked fine. Are you still having this issue?

cannyedge34 commented 6 years ago

@bparanj and @pacuna. i've made these changes in Dockerfile and it works like a charm for me:

Updated! My final Dockerfile:

FROM phusion/passenger-ruby24
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
# Additional packages: we are adding the netcat package so we can
# make pings to the database service
RUN apt-get update && apt-get install -y -o Dpkg::Options::="--force-confold" netcat
# Enable Nginx and Passenger
RUN rm -f /etc/service/nginx/down
# Add virtual host entry for the application. Make sure
# the file is in the correct path
RUN rm /etc/nginx/sites-enabled/default
ADD webapp.conf /etc/nginx/sites-enabled/webapp.conf
# In case we need some environmental variables in Nginx. Make sure
# the file is in the correct path
ADD rails-env.conf /etc/nginx/main.d/rails-env.conf
# Install gems: it's better to build an independent layer for the gems
# so they are cached during builds unless Gemfile changes WORKDIR /tmp
WORKDIR  /home/me/Desktop/webapp
COPY Gemfile  /home/me/Desktop/webapp/Gemfile
COPY Gemfile.lock  /home/me/Desktop/webapp/Gemfile.lock
RUN bundle install
COPY . /home/me/Desktop/webapp
RUN apt-get install -y tzdata
# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 80

Ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]

I hope be helpful!

Regards!