Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker support #24

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.dist

This file was deleted.

8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,4 @@ RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH

COPY Gemfile Gemfile.lock ./

COPY . .

RUN bundle install --binstubs

CMD puma -C config/puma.rb
ENV BUNDLE_PATH /bundle
16 changes: 15 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@ version: '2'

services:
db:
restart: 'always'
image: 'postgres:9.5'
ports:
- '5432:5432'
volumes:
- 'db:/var/lib/postgresql/data'

app:
restart: 'always'
depends_on:
- 'db'
build: .
ports:
- '3000:3000'
env_file: '.env'
volumes:
- '.:/test_track'
volumes_from:
- bundler_cache
command: ./script/serve
environment:
- DATABASE_URL=postgresql://postgres@db/test_track_development
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block you merging, but I'm curious why we went this direction? It's now not configurable without forking the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samandmoore can give his perspective, but basically the thinking is that if we're looking at this for local development then the user will have the repo cloned anyway, so it's not a problem to change this value. Also, this keeps all of the docker configuration in one place instead of spreading it to a .env file, which would potentially be used by a Rails project using dotenv.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this is strictly not for actually running the containerized server in a in a non-local environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, at the moment. I figure that if someone wants to run TT in production then they'll probably either fork the repo or just run the TT container outside of compose.


bundler_cache:
image: busybox
volumes:
- /bundle

volumes:
db:
7 changes: 7 additions & 0 deletions script/serve
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

echo "Checking for installed dependencies"
bundle check || bundle install --binstubs

echo "Starting Puma"
bin/puma -C config/puma.rb