Skip to content

Commit 11e5687

Browse files
committed
Updated to Ruby 3.4.1 and bitnami docker images
1 parent 4112a64 commit 11e5687

File tree

8 files changed

+70
-39
lines changed

8 files changed

+70
-39
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
Dockerfile
12
.dockerignore
23
.editorconfig
34
.git/
45
.github/
56
.gitignore
6-
Dockerfile
77
LICENSE.txt
88
*.md
99
*.sh

Dockerfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
FROM ruby:2.7.1
1+
FROM bitnami/ruby:latest
22

3-
# throw errors if Gemfile has been modified since Gemfile.lock
4-
RUN bundle config --global frozen 1
5-
6-
WORKDIR /usr/src/app
7-
8-
COPY Gemfile Gemfile.lock ./
9-
RUN bundle install
3+
WORKDIR /app
104

115
COPY . .
6+
RUN bundle install
127

138
ARG COMMIT="(not set)"
149
ARG LASTMOD="(not set)"
1510
ENV COMMIT=$COMMIT
1611
ENV LASTMOD=$LASTMOD
1712

1813
EXPOSE 4567
19-
CMD ["./regexplanet.rb"]
14+
CMD ["ruby", "./regexplanet.rb"]
2015

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
source "https://rubygems.org"
2-
ruby '2.7.1'
2+
ruby '3.4.1'
33
gem 'sinatra'
44
gem 'sinatra-contrib'
55
gem 'sinatra-jsonp'
6+
7+
gem "rackup", "~> 2.2"
8+
gem "puma", "~> 6.6"

Gemfile.lock

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,56 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
base64 (0.2.0)
5+
logger (1.6.5)
46
multi_json (1.15.0)
5-
mustermann (1.1.1)
7+
mustermann (3.0.3)
68
ruby2_keywords (~> 0.0.1)
7-
rack (2.2.3)
8-
rack-protection (2.2.0)
9-
rack
9+
nio4r (2.7.4)
10+
puma (6.6.0)
11+
nio4r (~> 2.0)
12+
rack (3.1.9)
13+
rack-protection (4.1.1)
14+
base64 (>= 0.1.0)
15+
logger (>= 1.6.0)
16+
rack (>= 3.0.0, < 4)
17+
rack-session (2.1.0)
18+
base64 (>= 0.1.0)
19+
rack (>= 3.0.0)
20+
rackup (2.2.1)
21+
rack (>= 3)
1022
ruby2_keywords (0.0.5)
11-
sinatra (2.2.0)
12-
mustermann (~> 1.0)
13-
rack (~> 2.2)
14-
rack-protection (= 2.2.0)
23+
sinatra (4.1.1)
24+
logger (>= 1.6.0)
25+
mustermann (~> 3.0)
26+
rack (>= 3.0.0, < 4)
27+
rack-protection (= 4.1.1)
28+
rack-session (>= 2.0.0, < 3)
1529
tilt (~> 2.0)
16-
sinatra-contrib (2.2.0)
17-
multi_json
18-
mustermann (~> 1.0)
19-
rack-protection (= 2.2.0)
20-
sinatra (= 2.2.0)
30+
sinatra-contrib (4.1.1)
31+
multi_json (>= 0.0.2)
32+
mustermann (~> 3.0)
33+
rack-protection (= 4.1.1)
34+
sinatra (= 4.1.1)
2135
tilt (~> 2.0)
2236
sinatra-jsonp (0.5.0)
2337
multi_json (~> 1.8)
2438
sinatra (>= 1.0)
25-
tilt (2.0.10)
39+
tilt (2.6.0)
2640

2741
PLATFORMS
2842
ruby
43+
x86_64-darwin-24
2944

3045
DEPENDENCIES
46+
puma (~> 6.6)
47+
rackup (~> 2.2)
3148
sinatra
3249
sinatra-contrib
3350
sinatra-jsonp
3451

3552
RUBY VERSION
36-
ruby 2.7.1p83
53+
ruby 3.4.1p0
3754

3855
BUNDLED WITH
39-
2.1.4
56+
2.6.2

config.ru

Lines changed: 0 additions & 2 deletions
This file was deleted.

docker-run.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
#
3+
# run the docker container version locally
4+
#
5+
6+
set -o errexit
7+
set -o pipefail
8+
set -o nounset
29

310

411
docker build -t regexplanet-ruby .
12+
13+
514
docker run \
615
--expose 4000 \
716
--env COMMIT=$(git rev-parse --short HEAD)-local \

regexplanet.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/ruby
1+
#!/usr/bin/env ruby
22

33
require 'cgi'
44
require 'sinatra'
@@ -11,6 +11,7 @@
1111
mime_type :svg, 'image/svg+xml'
1212
set :static_cache_control, [:public, {:max_age => 604800 } ]
1313
set :bind, '0.0.0.0'
14+
set :host_authorization, { permitted_hosts: [] }
1415
#set :protection, :except => [:frame_options ]
1516
#disable :protection
1617
end
@@ -43,6 +44,7 @@ def get_or_post(path, opts={}, &block)
4344
:tech => "Ruby #{RUBY_VERSION}",
4445
:timestamp => Time.now.utc.iso8601,
4546
:version => RUBY_VERSION,
47+
:detail => RUBY_DESCRIPTION,
4648
"request.host" => request.host,
4749
"request.port" => request.port,
4850
:RUBY_DESCRIPTION => RUBY_DESCRIPTION,
@@ -275,7 +277,9 @@ def get_or_post(path, opts={}, &block)
275277
end
276278

277279
get '/' do
278-
redirect 'https://www.regexplanet.com/advanced/ruby/index.html'
280+
headers \
281+
'Content-Type' => 'text/plain'
282+
"Running Ruby " + RUBY_VERSION + " on " + RUBY_PLATFORM
279283
end
280284

281285
helpers do

run.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
#
3+
# run locally
4+
#
25

6+
set -o errexit
7+
set -o pipefail
8+
set -o nounset
39

4-
docker build -t regexplanet-ruby .
5-
docker run \
6-
-p 4000:4000 --expose 4000 -e PORT='4000' \
7-
-e COMMIT=$(git rev-parse --short HEAD) \
8-
-e LASTMOD=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
9-
regexplanet-ruby
10+
11+
bundle install
12+
13+
export PORT=4000
14+
./regexplanet.rb

0 commit comments

Comments
 (0)