Skip to content

Commit 921ef67

Browse files
committed
Added Dockerfile, docker-compose
1 parent 910853b commit 921ef67

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ruby:2.6.0
2+
3+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
4+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
5+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
6+
apt-get update && \
7+
apt-get install -qq -y build-essential nodejs yarn \
8+
libpq-dev postgresql-client
9+
RUN mkdir /myapp
10+
WORKDIR /myapp
11+
COPY . /myapp
12+
RUN bundle install
13+
RUN yarn install --check-files

config/database.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ default: &default
2828
development:
2929
<<: *default
3030
database: sample_post_api_development
31+
host: db
32+
port: 5432
3133

3234
# The specified database role being used to connect to postgres.
3335
# To create additional roles in postgres see `$ createuser --help`.

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3'
2+
services:
3+
db:
4+
image: postgres:10.10
5+
volumes:
6+
- pgdata:/var/lib/postgresql/data
7+
ports:
8+
- "5433:5432"
9+
web:
10+
build: .
11+
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
12+
volumes:
13+
- .:/myapp
14+
ports:
15+
- "3000:3000"
16+
depends_on:
17+
- db
18+
volumes:
19+
pgdata:

0 commit comments

Comments
 (0)