Skip to content

Commit

Permalink
make docker-compose use docker-for-mac or local docker by default
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Apr 26, 2018
1 parent 9b42a18 commit 0338d1d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env.compose → .env.virtualbox
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# test application samson-compose from some-public-token user (192.168.42.45:9080)
# in case you are running on virtualbox based docker
DEFAULT_URL="http://192.168.42.45:9080"
bin/decode_dot_env-R0lUSFVCX0NMSUVOVF9JRD1iMmUxMmRlMGNiN2QzMDFkNjE1OA==
bin/decode_dot_env-R0lUSFVCX1NFQ1JFVD00MzQ2NDcyZjNkMTY4ZmI3MmNhNTQwYTA0ZDJkMjc3YzBjYjhmMjQ3
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ COPY bin /app/bin
COPY public /app/public
COPY db /app/db
COPY .env.bootstrap /app/.env
COPY .env.virtualbox /app/
COPY .ruby-version /app/.ruby-version

# NPM
COPY package.json /app/package.json
RUN npm install
RUN npm install --silent

# Gems
COPY Gemfile /app/
Expand All @@ -33,7 +34,6 @@ COPY lib /app/lib

# Assets
COPY vendor/assets /app/vendor/assets
COPY .env.compose /app/
RUN echo "takes 5 minute" && ./bin/decode_dot_env .env && RAILS_ENV=production PRECOMPILE=1 bundle exec rake assets:precompile

EXPOSE 9080
Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ services:
samson:
image: zendesk/samson:latest
ports:
- "9080:9080"
- "3000:9080"
environment:
DATABASE_URL: "sqlite3://db/development.sqlite"
RAILS_LOG_TO_STDOUT: 1
command: ["bash", "-c", "./bin/decode_dot_env .env.compose && source <(sed -E -n 's/[^#]+/export &/ p' .env.compose) && rake db:setup && bundle exec puma -C config/puma.rb"]
# to use .env.virtualbox with 192.168.42.45 host prefix ./bin/decode_dot_env .env.virtualbox && source <(sed -E -n 's/[^#]+/export &/ p' .env.virtualbox) &&
command: ["bash", "-c", "rake db:setup && bundle exec puma -C config/puma.rb"]
5 changes: 3 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

```bash
docker-compose up
open http://$DOCKER_HOST_IP:9080
open http://localhost:3000
```

When not running on `192.168.42.45` use a different auth provider, the IP is hardcoded.
When running on virtual `192.168.42.45` use `.env.virtualbox` from `docker-compose.yml`.
When running on neither localhost nor `192.168.42.45` create your own credentials and load them from `docker-compose.yml`.

### Local
```bash
Expand Down

0 comments on commit 0338d1d

Please sign in to comment.