Skip to content

Commit

Permalink
Dynamic ports (#462)
Browse files Browse the repository at this point in the history
* Dynamic port in compose file

* Omit setting container name

* Add initial sql dump entry

* Avoid resetting database on build
  • Loading branch information
icarito committed Apr 7, 2019
1 parent f8e3816 commit e8e9d9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=3000
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ build:
cp config/config.yml.example config/config.yml
cp config/initializers/recaptcha.rb.example config/initializers/recaptcha.rb
cp db/schema.rb.example db/schema.rb
docker-compose down --remove-orphans
docker-compose build
docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile"

deploy-container:
docker-compose run --rm web bash -l -c "sleep 10 && bower install --allow-root && rake db:setup && rake db:migrate && rake assets:precompile"
docker-compose up -d

redeploy-container:
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
version: '3.3'
services:
db:
container_name: db
image: mysql:5.7
env_file:
- mapknitter.env
volumes:
- ../mysql:/var/lib/mysql
- ../dump:/docker-entrypoint-initdb.d
web:
container_name: web
image: mapknitter-dev
build:
context: .
Expand All @@ -20,7 +19,7 @@ services:
- bundle_cache:/usr/local/bundle
- bower_cache:/app/public/lib
ports:
- 3000:3000
- $PORT:3000
depends_on:
- db

Expand Down

0 comments on commit e8e9d9c

Please sign in to comment.