Skip to content

Commit 6f0bb1a

Browse files
committed
[RAILS] Added Docker configuration for the example applications
1 parent dabc482 commit 6f0bb1a

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tmp/*
2+
log/*
3+
.git
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
searchapp-*
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# docker build --tag searchapp-01 --build-arg PATH_TO_APPLICATION=searchapp-01 .
2+
3+
FROM ruby:2.3
4+
5+
6+
7+
ARG PATH_TO_APPLICATION
8+
9+
RUN apt-get update && apt-get install --yes --fix-missing \
10+
build-essential \
11+
sqlite3 \
12+
libsqlite3-dev \
13+
nodejs
14+
15+
RUN mkdir -p /app
16+
WORKDIR /app
17+
18+
COPY ${PATH_TO_APPLICATION}/Gemfile ${PATH_TO_APPLICATION}/Gemfile.lock ./
19+
RUN gem install bundler && bundle install --jobs 4 --retry 3
20+
21+
COPY ${PATH_TO_APPLICATION} ./
22+
23+
EXPOSE 3000
24+
25+
ENV RAILS_ENV=production RAILS_SERVE_STATIC_FILES=true
26+
27+
RUN rm -f /app/tmp/pids/server.pid
28+
29+
CMD ["bundle", "exec", "rails", "server", "-p", "3000", "-b", "0.0.0.0"]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: '2'
2+
3+
services:
4+
searchapp-01:
5+
build:
6+
context: .
7+
args:
8+
PATH_TO_APPLICATION: ./searchapp-01
9+
command: rails server -p 3000 -b '0.0.0.0'
10+
environment:
11+
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
12+
ports:
13+
- "3001:3000"
14+
15+
searchapp-02:
16+
build:
17+
context: .
18+
args:
19+
PATH_TO_APPLICATION: ./searchapp-02
20+
command: rails server -p 3000 -b '0.0.0.0'
21+
environment:
22+
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
23+
ports:
24+
- "3002:3000"
25+
26+
searchapp-03:
27+
build:
28+
context: .
29+
args:
30+
PATH_TO_APPLICATION: ./searchapp-03
31+
command: rails server -p 3000 -b '0.0.0.0'
32+
environment:
33+
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
34+
- REDIS_URL=redis://redis:6379
35+
ports:
36+
- "3003:3000"
37+
links:
38+
- redis
39+
40+
redis:
41+
image: redis:alpine
42+
command: redis-server
43+
ports: ["6379"]

0 commit comments

Comments
 (0)