Last active
December 30, 2016 13:58
-
-
Save oivoodoo/b7afde3e0dda143c989089ff75ed1023 to your computer and use it in GitHub Desktop.
Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2" | |
services: | |
elasticsearch: | |
image: elasticsearch:latest | |
container_name: musicfeedserver_elasticsearch | |
ports: ["9200"] | |
networks: | |
- back-tier | |
rabbitmq: | |
image: rabbitmq:3-management | |
container_name: musicfeedserver_rabbitmq | |
ports: ["5672", "15672"] | |
networks: | |
- back-tier | |
redis: | |
image: redis:alpine | |
container_name: musicfeedserver_redis | |
ports: ["6379"] | |
networks: | |
- back-tier | |
db: | |
image: postgres:9.4 | |
container_name: musicfeedserver_db | |
volumes: | |
- "db-data:/var/lib/postgresql/data" | |
networks: | |
- back-tier | |
volumes: | |
db-data: | |
networks: | |
back-tier: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rails:latest | |
WORKDIR /app | |
RUN apt-get update | |
RUN apt-get install -y tmux | |
RUN gem install bundler --no-ri --no-rdoc | |
RUN bundle config git.allow_insecure true | |
RUN bundle config path /app/vendor | |
RUN bundle config bin /app/vendor/ruby/2.3.0/bin/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION = 2.3.0 | |
NAME = musicfeedserver | |
build: clean | |
docker-compose up -d | |
docker build -t $(NAME) . | |
docker run --rm -t -i \ | |
--network=$(NAME)_back-tier \ | |
-e BUNDLE_PATH=/app/vendor \ | |
-e BUNDLE_BIN=/app/vendor/ruby/2.3.0/bin/ \ | |
-v `pwd`:/app \ | |
-v `pwd`/vendor:/app/vendor \ | |
--dns 8.8.8.8 \ | |
-w /app \ | |
$(NAME) \ | |
/bin/bash -c "bundle install --path /app/vendor && bundle exec rake db:setup && RAILS_ENV=test bundle exec rake db:setup" | |
.PHONY: build | |
clean: | |
docker rmi --force $(NAME) || true | |
.PHONY: clean | |
test: | |
docker run --rm -t -i \ | |
--network=$(NAME)_back-tier \ | |
-e BUNDLE_PATH=/app/vendor \ | |
-e BUNDLE_BIN=/app/vendor/ruby/2.3.0/bin/ \ | |
-v `pwd`:/app \ | |
-v `pwd`/vendor:/app/vendor \ | |
--dns 8.8.8.8 \ | |
-w /app \ | |
$(NAME) \ | |
/bin/bash -c "bundle exec rspec $(TEST_CASE)" | |
.PHONY: test | |
console: | |
docker run --rm -t -i \ | |
--network=$(NAME)_back-tier \ | |
-e BUNDLE_PATH=/app/vendor \ | |
-e BUNDLE_BIN=/app/vendor/ruby/2.3.0/bin/ \ | |
-v `pwd`:/app \ | |
-v `pwd`/vendor:/app/vendor \ | |
--dns 8.8.8.8 \ | |
-w /app \ | |
$(NAME) \ | |
/bin/bash | |
.PHONY: console | |
deploy: | |
docker run --rm -t -i \ | |
--network=$(NAME)_back-tier \ | |
-e BUNDLE_PATH=/app/vendor \ | |
-e BUNDLE_BIN=/app/vendor/ruby/2.3.0/bin/ \ | |
-v `pwd`:/app \ | |
-v `pwd`/vendor:/app/vendor \ | |
-v ~/.ssh/:/root/.ssh/ \ | |
--dns 8.8.8.8 \ | |
-w /app \ | |
$(NAME) \ | |
/bin/bash -c "bundle exec cap production ROLES=app,sidekiq deploy" | |
.PHONY: console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment