Skip to content

Commit 908e1e9

Browse files
committed
Fix Ruby quickstart container startup
1 parent 744e5b3 commit 908e1e9

3 files changed

Lines changed: 50 additions & 3 deletions

File tree

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Use the official lightweight Ruby image.
22
# https://hub.docker.com/_/ruby
33
FROM ruby:3.3-slim
4+
ENV RACK_ENV=production
45

56
# Install production dependencies.
67
WORKDIR /usr/src/app
7-
COPY Gemfile ./
8-
RUN bundle install
8+
COPY Gemfile Gemfile.lock ./
9+
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
10+
&& bundle install \
11+
&& apt-get purge -y --auto-remove build-essential \
12+
&& rm -rf /var/lib/apt/lists/*
913

1014
# Copy local code to the container image.
1115
COPY . ./
1216

1317
# Run the web service on container startup.
14-
CMD ["ruby", "./app.rb"]
18+
CMD ["bundle", "exec", "ruby", "./app.rb"]

quickstarts/languages/ruby/Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
22

33
gem 'sinatra'
44
gem 'rack', '>= 2.0.6'
5+
gem 'rackup'
6+
gem 'puma'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
base64 (0.3.0)
5+
logger (1.7.0)
6+
mustermann (3.1.1)
7+
nio4r (2.7.5)
8+
puma (8.0.2)
9+
nio4r (~> 2.0)
10+
rack (3.2.6)
11+
rack-protection (4.2.1)
12+
base64 (>= 0.1.0)
13+
logger (>= 1.6.0)
14+
rack (>= 3.0.0, < 4)
15+
rack-session (2.1.2)
16+
base64 (>= 0.1.0)
17+
rack (>= 3.0.0)
18+
rackup (2.3.1)
19+
rack (>= 3)
20+
sinatra (4.2.1)
21+
logger (>= 1.6.0)
22+
mustermann (~> 3.0)
23+
rack (>= 3.0.0, < 4)
24+
rack-protection (= 4.2.1)
25+
rack-session (>= 2.0.0, < 3)
26+
tilt (~> 2.0)
27+
tilt (2.7.0)
28+
29+
PLATFORMS
30+
aarch64-linux
31+
ruby
32+
x86_64-linux
33+
34+
DEPENDENCIES
35+
puma
36+
rack (>= 2.0.6)
37+
rackup
38+
sinatra
39+
40+
BUNDLED WITH
41+
2.5.22

0 commit comments

Comments
 (0)