Skip to content

Commit 63d99a2

Browse files
committed
Torquebox image
1 parent f381a9e commit 63d99a2

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed

centos-torquebox/Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# centos-torquebox
2+
3+
FROM centos
4+
MAINTAINER Jakub Hadvig <[email protected]>
5+
6+
RUN mkdir -p /opt/torquebox && useradd torquebox -c"Torquebox system user" -M -ptorquebox
7+
8+
RUN yum update --assumeyes && \
9+
yum install --assumeyes java-1.7.0-openjdk.x86_64 wget unzip sqlite-devel libsqlite3x-devel zlib-devel libxslt-devel libxml2-devel nodejs010-nodejs && \
10+
yum clean all && \
11+
cd /opt/ && \
12+
wget http://torquebox.org/release/org/torquebox/torquebox-dist/3.0.0/torquebox-dist-3.0.0-bin.zip && unzip torquebox-dist-3.0.0-bin.zip -d /opt/torquebox
13+
14+
ENV TORQUEBOX_HOME /opt/torquebox/torquebox-3.0.0
15+
ENV JBOSS_HOME $TORQUEBOX_HOME/jboss
16+
ENV JRUBY_HOME $TORQUEBOX_HOME/jruby
17+
ENV PATH $JRUBY_HOME/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre/bin:$PATH
18+
19+
RUN mkdir -p /opt/jruby/{src,bin}
20+
21+
ENV APP_ROOT .
22+
ENV HOME /opt/jruby
23+
24+
RUN chown -R torquebox:torquebox /opt/torquebox
25+
26+
ADD ./bin /opt/jruby/bin/
27+
28+
RUN cp -f /opt/jruby/bin/prepare /usr/bin/prepare && \
29+
cp -f /opt/jruby/bin/run /usr/bin/run
30+
31+
EXPOSE 9999 9990 9443 8009 8080 8443 45700 7600 57600 55200 45688 54200 5445 9876 5455 23364 4447 4712 4713 8675 8676
32+
33+
CMD ["/opt/jruby/bin/start"]

centos-torquebox/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Step 1: Build the base image:
2+
3+
$ docker build -t centos-torquebox .
4+
5+
Step 2: Change dir to your application:
6+
7+
$ cd /path/to/ruby/app
8+
9+
Step 3: Create a container with the base image and your application:
10+
11+
$ docker run -v $(pwd):/tmp/src centos-torquebox
12+
13+
Step 4: Commit it:
14+
15+
$ docker commit <HOSTNAME> torquebox-ruby-app
16+
17+
Step 5: Run the container:
18+
19+
$ docker run -i -t --rm -p 8080:8080 torquebox-ruby-app

centos-torquebox/bin/prepare

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh -e
2+
3+
app_runtime_dir="${HOME}/src"
4+
app_src_dir="/tmp/src"
5+
6+
echo "---> Installing application source"
7+
cp -Rf ${app_src_dir}/* ${app_runtime_dir}/
8+
9+
pushd "$app_runtime_dir/${APP_ROOT}" >/dev/null
10+
echo "---> Building your Ruby application from source"
11+
12+
if [ -f Gemfile ]; then
13+
echo "---> Installing dependencies using Bundler"
14+
15+
jruby -S bundle install
16+
17+
fi
18+
19+
# TODO: Add `rake assets:precompile` step here for Rails applications
20+
# TODO: Add `rake db:migrate` if linked with DB container
21+
22+
popd >/dev/null

centos-torquebox/bin/run

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash -e
2+
3+
export app_root_dir="${HOME}/src/${APP_ROOT:-.}"
4+
5+
export RACK_ENV=${RACK_ENV:-"production"}
6+
export RAILS_ENV=${RAILS_ENV:-"${RACK_ENV}"}
7+
8+
cd $app_root_dir
9+
10+
torquebox deploy $app_root_dir --env=$RAILS_ENV
11+
12+
exec torquebox run -b 0.0.0.0
13+

centos-torquebox/bin/start

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -e
2+
3+
# Build the jruby application first
4+
#
5+
${HOME}/bin/prepare
6+
7+
# Replace this script with the application runner at the end of the build.
8+
#
9+
echo "---> Build successful. Commit this image with: docker commit ${HOSTNAME} torquebox-ruby-app"
10+
cp -f ${HOME}/bin/run ${HOME}/bin/start && exit

0 commit comments

Comments
 (0)