forked from docker-library/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·23 lines (17 loc) · 747 Bytes
/
update.sh
File metadata and controls
executable file
·23 lines (17 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
set -e
rubyBase='2.3'
rubyOnbuildDockerfile="https://raw.githubusercontent.com/docker-library/ruby/master/$rubyBase/onbuild/Dockerfile"
current="$(curl -sSL 'https://rubygems.org/api/v1/gems/rails.json' | sed -r 's/^.*"version":"([^"]+)".*$/\1/')"
set -x
curl -sSL "$rubyOnbuildDockerfile" -o onbuild/Dockerfile
echo >> onbuild/Dockerfile
grep '^RUN.*apt-get install' Dockerfile >> onbuild/Dockerfile
echo >> onbuild/Dockerfile
echo 'EXPOSE 3000' >> onbuild/Dockerfile
echo 'CMD ["rails", "server", "-b", "0.0.0.0"]' >> onbuild/Dockerfile
sed -ri 's/^(FROM ruby):.*/\1:'"$rubyBase"'/' onbuild/Dockerfile
sed -ri '
s/^FROM .*/'"$(grep -m1 '^FROM' onbuild/Dockerfile)"'/;
s/^(ENV RAILS_VERSION) .*/\1 '"$current"'/;
' Dockerfile