Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
faizaanmadhani committed Mar 10, 2020
1 parent 96ae66d commit ab126a1
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ruby:2.5.1
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp

# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
2 changes: 1 addition & 1 deletion config/initializers/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ENV['DB_PASS_DEV'] = 'sdcdev'
ENV['DB_USER_DEV'] = 'postgres'
ENV['DB_NAME_DEV'] = 'sdc'
ENV['DB_HOST_DEV'] = 'localhost'
ENV['DB_HOST_DEV'] = 'db'
ENV['DB_PORT_DEV'] = '5432'
ENV['DB_TIMEOUT_DEV'] = '5000'
ENV['DB_ADAPTER_DEV'] = 'postgresql'
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=sdcdev
- POSTGRES_DB=sdc
ports:
- "5432:5432"
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/myapp
ports:
- "3000:3000"
depends_on:
- db
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid

# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "$@"
12 changes: 12 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
build:
docker:
web: Dockerfile
config:
BUNDLE_INSTALL_ARGS: --jobs 10 --retry=3 --without development test
RAILS_ENV: production
run:
web: bundle exec puma -C config/puma.rb
worker:
command:
- bundle exec rake jobs:work
image: web

0 comments on commit ab126a1

Please sign in to comment.