mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Modify the binstubs to run things in docker
This commit is contained in:
parent
99ef4af3e5
commit
faceaac874
7 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
load Gem.bin_path('bundler', 'bundle')
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
load File.expand_path("../spring", __FILE__)
|
load File.expand_path("../spring", __FILE__)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
|
|
||||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rails/commands'
|
require 'rails/commands'
|
||||||
|
|
3
bin/rake
3
bin/rake
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
Rake.application.run
|
Rake.application.run
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
if ENV["RAILS_ENV"] != "production"
|
||||||
|
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
|
||||||
|
end
|
||||||
|
|
||||||
# This file loads spring without using Bundler, in order to be fast
|
# This file loads spring without using Bundler, in order to be fast
|
||||||
# It gets overwritten when you run the `spring binstub` command
|
# It gets overwritten when you run the `spring binstub` command
|
||||||
|
|
16
script/docker-environment
Executable file
16
script/docker-environment
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Run a command in the app's environment
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Find our app dir and just run the command in we're in the container since the
|
||||||
|
# container is built with an /etc/app-env file inside of it.
|
||||||
|
appdir=$(cd $(dirname "$0")/.. && pwd)
|
||||||
|
[ -f /etc/app-env ] && exec "$@"
|
||||||
|
|
||||||
|
# Otherwise, run docker compose to run our command in the container
|
||||||
|
cmd="$@"; [ "$#" -eq 0 ] && cmd=bash
|
||||||
|
export VOLUME="$appdir:/app"
|
||||||
|
image=${DOCKER_IMAGE:=web}
|
||||||
|
|
||||||
|
exec docker-compose run --rm $image $cmd
|
Loading…
Add table
Add a link
Reference in a new issue