Skip to content

Commit 8ca059e

Browse files
committed
Update Dockerfile to ruby 2.4 alpine
1 parent 6385081 commit 8ca059e

File tree

7 files changed

+79
-65
lines changed

7 files changed

+79
-65
lines changed

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Logs and databases #
2+
######################
3+
*.log
4+
*.sqlite
5+
6+
# OS generated files #
7+
######################
8+
.DS_Store*
9+
ehthumbs.db
10+
Icon?
11+
Thumbs.db
12+
13+
# SASS Cache
14+
.sass-cache/
15+
tmp/
16+
17+
# Elastic Beanstalk Files
18+
.elasticbeanstalk/*
19+
20+
.ruby-version
21+
docker-compose.yml
22+
23+
.Gemfile.EXAMPLE
24+
Rakefile.EXAMPLE
25+
install_*.sql
26+
.git

Dockerfile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM springest/ruby:2.1.5
1+
FROM ruby:2.4.0-alpine
22

33
# Environment variables:
44
ENV RACK_ENV ''
@@ -16,19 +16,29 @@ ENV READ_DATABASES ''
1616
ENV MISC_DEFAULT false
1717
ENV MISC_DBLISTMATCH false
1818

19+
RUN apk update && apk --update add postgresql-client libstdc++
20+
1921
# Rubygems and bundler
2022
RUN gem update --system --no-ri --no-rdoc
2123
RUN gem install bundler --no-ri --no-rdoc
2224

23-
# python-software-properties is required for add-apt-repository.
24-
RUN useradd asq
25-
RUN mkdir /home/asq
26-
ADD . /home/asq
27-
RUN chown -R asq: /home/asq
25+
RUN mkdir /app
26+
27+
ADD Gemfile /app/
28+
ADD Gemfile.lock /app/
29+
30+
WORKDIR /app
31+
32+
RUN apk --update add --virtual build-dependencies g++ musl-dev make \
33+
postgresql-dev && \
34+
bundle install --deployment && \
35+
apk del build-dependencies
36+
37+
ADD . /app
2838

29-
WORKDIR /home/asq
39+
RUN chown -R nobody:nogroup /app
40+
USER nobody
3041

31-
RUN su asq -c 'bundle install --deployment'
32-
CMD su asq -c /home/asq/docker_runner.rb
42+
CMD /app/docker_runner.rb
3343

3444
EXPOSE 3000

Dockerrun.aws.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@
44
{
55
"ContainerPort": "3000"
66
}
7-
],
8-
"Volumes": [
9-
{
10-
"HostDirectory": "/var/app",
11-
"ContainerDirectory": "/var/app"
12-
}
137
]
148
}

Gemfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
source 'http://rubygems.org'
1+
source 'https://rubygems.org'
22

33
gem 'sinatra'
44
gem 'net-ssh'
55
gem 'shotgun'
66
gem 'sequel'
7+
gem 'bacon'
78
gem 'sinatra-sequel'
89
gem 'omniauth-google-oauth2'
910
gem 'rake'
1011

11-
group :production do
12-
gem 'unicorn'
13-
end
14-
1512
# Frontend
1613
gem 'haml'
1714
gem 'sass'
18-
gem 'json'
1915
gem 'thin'
2016
gem 'htmlentities'
2117

2218
# DB, uncomment which one you want.
2319
# Also add config to the `config.yml` for the specified adapter.
24-
gem 'mysql2'
20+
# gem 'mysql2'
2521
gem 'pg'
26-
gem 'sqlite3'
22+
# gem 'sqlite3'

Gemfile.EXAMPLE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
source 'http://rubygems.org'
22

3-
gem 'thin'
43
gem 'sinatra'
54
gem 'net-ssh'
65
gem 'shotgun'
76
gem 'sequel'
87
gem 'sinatra-sequel'
9-
8+
gem 'omniauth-google-oauth2'
9+
gem 'rake'
1010

1111
# Frontend
1212
gem 'haml'
1313
gem 'sass'
14-
gem 'json'
14+
gem 'thin'
1515
gem 'htmlentities'
1616

1717
# DB, uncomment which one you want.
1818
# Also add config to the `config.yml` for the specified adapter.
1919
#gem 'mysql2'
2020
#gem 'pg'
21-
#gem 'sqlite3'
21+
#gem 'sqlite3'

Gemfile.lock

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
GEM
2-
remote: http://rubygems.org/
2+
remote: https://rubygems.org/
33
specs:
44
bacon (1.2.0)
5-
daemons (1.2.3)
6-
eventmachine (1.2.0.1)
7-
faraday (0.9.2)
5+
daemons (1.2.4)
6+
eventmachine (1.2.3)
7+
faraday (0.11.0)
88
multipart-post (>= 1.2, < 3)
99
haml (4.0.7)
1010
tilt
11-
hashie (3.4.4)
11+
hashie (3.5.5)
1212
htmlentities (4.3.4)
13-
json (1.8.3)
14-
jwt (1.5.4)
15-
kgio (2.10.0)
13+
jwt (1.5.6)
1614
multi_json (1.12.1)
17-
multi_xml (0.5.5)
15+
multi_xml (0.6.0)
1816
multipart-post (2.0.0)
19-
mysql2 (0.4.4)
20-
net-ssh (3.1.1)
21-
oauth2 (1.0.0)
22-
faraday (>= 0.8, < 0.10)
17+
net-ssh (4.1.0)
18+
oauth2 (1.3.1)
19+
faraday (>= 0.8, < 0.12)
2320
jwt (~> 1.0)
2421
multi_json (~> 1.3)
2522
multi_xml (~> 0.5)
26-
rack (~> 1.2)
27-
omniauth (1.3.1)
28-
hashie (>= 1.2, < 4)
29-
rack (>= 1.0, < 3)
23+
rack (>= 1.2, < 3)
24+
omniauth (1.6.1)
25+
hashie (>= 3.4.6, < 3.6.0)
26+
rack (>= 1.6.2, < 3)
3027
omniauth-google-oauth2 (0.4.1)
3128
jwt (~> 1.5.2)
3229
multi_json (~> 1.3)
@@ -35,42 +32,35 @@ GEM
3532
omniauth-oauth2 (1.4.0)
3633
oauth2 (~> 1.0)
3734
omniauth (~> 1.2)
38-
pg (0.18.4)
39-
rack (1.6.4)
35+
pg (0.20.0)
36+
rack (1.6.5)
4037
rack-protection (1.5.3)
4138
rack
42-
raindrops (0.16.0)
43-
rake (11.1.2)
44-
sass (3.4.22)
45-
sequel (4.35.0)
46-
shotgun (0.9.1)
39+
rake (12.0.0)
40+
sass (3.4.23)
41+
sequel (4.44.0)
42+
shotgun (0.9.2)
4743
rack (>= 1.0)
48-
sinatra (1.4.7)
44+
sinatra (1.4.8)
4945
rack (~> 1.5)
5046
rack-protection (~> 1.4)
5147
tilt (>= 1.3, < 3)
5248
sinatra-sequel (0.9.0)
53-
bacon
5449
sequel (>= 3.2.0)
5550
sinatra (>= 0.9.4)
56-
sqlite3 (1.3.11)
5751
thin (1.7.0)
5852
daemons (~> 1.0, >= 1.0.9)
5953
eventmachine (~> 1.0, >= 1.0.4)
6054
rack (>= 1, < 3)
61-
tilt (2.0.5)
62-
unicorn (5.1.0)
63-
kgio (~> 2.6)
64-
raindrops (~> 0.7)
55+
tilt (2.0.6)
6556

6657
PLATFORMS
6758
ruby
6859

6960
DEPENDENCIES
61+
bacon
7062
haml
7163
htmlentities
72-
json
73-
mysql2
7464
net-ssh
7565
omniauth-google-oauth2
7666
pg
@@ -80,9 +70,7 @@ DEPENDENCIES
8070
shotgun
8171
sinatra
8272
sinatra-sequel
83-
sqlite3
8473
thin
85-
unicorn
8674

8775
BUNDLED WITH
88-
1.11.2
76+
1.14.3

docker_runner.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def get_env_or_fail(name)
99
end
1010
end
1111

12-
File.open("/home/asq/config.yml", "w") do |config|
12+
File.open("/app/config.yml", "w") do |config|
1313
config.puts "database:"
1414
config.puts " adapter: #{get_env_or_fail("DB_ADAPTER")}"
1515
config.puts " host: #{get_env_or_fail("DB_HOSTNAME")}"
@@ -32,5 +32,5 @@ def get_env_or_fail(name)
3232
config.puts " dblistMatch: #{get_env_or_fail("MISC_DBLISTMATCH")}"
3333
end
3434

35-
Dir.chdir("/home/asq")
35+
Dir.chdir("/app")
3636
exec("/usr/bin/env bundle exec thin start -p 3000")

0 commit comments

Comments
 (0)