-
Notifications
You must be signed in to change notification settings - Fork 33
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
Changes from 8 commits
315bd2c
6577942
78ecf26
0b07356
59ef275
cfce5f0
3f3d02b
a67b147
42dbba6
367d447
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.dockerignore | ||
Dockerfile | ||
.byebug_history | ||
/log/* | ||
/tmp/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM amazonlinux | ||
|
||
RUN yum install -y ruby23-devel git gcc gcc-c++ postgresql-devel zlib-devel | ||
|
||
RUN gem install bundler | ||
|
||
ENV INSTALL_PATH /test_track | ||
|
||
RUN mkdir -p $INSTALL_PATH | ||
|
||
WORKDIR $INSTALL_PATH | ||
|
||
ENV BUNDLE_PATH /bundle |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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' | ||
volumes: | ||
- '.:/test_track' | ||
volumes_from: | ||
- bundler_cache | ||
command: ./script/serve | ||
environment: | ||
- DATABASE_URL=postgresql://postgres@db/test_track_development | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore the dockerignore? what's this file for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An overview of the dockerignore file is here: https://docs.docker.com/engine/reference/builder/#/dockerignore-file, but in short it matches glob patterns and excludes them from any COPY and ADD instructions. Adding the dockerignore file to itself is basically saying "don't copy the dockerignore when you copy the rest of the directory over".
The actual Dockerfile should probably be here too.There's not much gained by ignoring them, it just feels a bit neater to me.edit: added the Dockerfile to the ignore