Skip to content

Instantly share code, notes, and snippets.

@carlzulauf
Last active March 14, 2019 18:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlzulauf/b6d738e05ee812d25b0f9e09bee50400 to your computer and use it in GitHub Desktop.
Save carlzulauf/b6d738e05ee812d25b0f9e09bee50400 to your computer and use it in GitHub Desktop.
Core .bin files
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "run app #{ARGV.join(' ')}"
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "build"
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "run app rails console", RAILS_ENV: "test"
#!/usr/bin/env ruby
require_relative "lib.rb"
dc *ARGV
##
# docker-compose.override.yml
#
# This file is used for local development environment configuration.
#
# It persists container data in named volumes, mounts application code
# to reflect edits and changes, and exposes services to the host for
# easier access.
##
version: "2"
services:
app:
build:
context: .
args:
- APP_NAME=${COMPOSE_PROJECT_NAME}
- BUNDLER_ARGS=--without production --with development test
depends_on:
- amqp
- cache
- pg
- redis
environment:
- RAILS_ENV
env_file:
- .env
ports:
- 3000:3000
volumes:
- .:/weedmaps
amqp:
build: docker/amqp
# ports:
# - 5672:5672
# - 15672:15672
cache:
build: docker/cache
# ports:
# - 11211:11211
redis:
build: docker/redis
# ports:
# - 6379:6379
volumes:
- redis_data:/data
pg:
build: docker/pg
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
- POSTGRES_DB=${DB_NAME}
# ports:
# - 5432:5432
volumes:
- pg_data:/var/lib/postgresql/data
volumes:
pg_data:
redis_data:
def config_files
%w(
docker-compose.yml
.bin/docker-compose.override.yml
docker-compose.test.yml
)
end
def dc(*the_rest, **env)
files = config_files.map{ |c| "-f #{c}" }.join(" ")
cmds = ["docker-compose #{files}", *the_rest]
env.each { |k,v| cmds.prepend "#{k}=#{v}" }
cmd = cmds.join(" ")
puts cmd
system cmd
end
#!/usr/bin/env ruby
require_relative "lib.rb"
require 'pry'
dc "run app rspec", *ARGV.map { |a| a =~ /spec.+\[/ ? "'#{a}'" : a }
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "up -d"
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "down"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment