Handle empty database password properly, don't try to run docker-compose inside the container

This commit is contained in:
Jyri-Petteri Paloposki 2020-07-19 21:30:24 +03:00
parent 53c7c94306
commit 85e104006c
7 changed files with 15 additions and 8 deletions

View file

@ -5,6 +5,8 @@ RUN bundle config --global frozen 1
WORKDIR /app
RUN touch /etc/app-env
COPY Gemfile* /app/
RUN gem install bundler
RUN bundle install --jobs 4
@ -17,8 +19,7 @@ COPY config/site.docker.yml /app/config/site.yml
RUN RAILS_ENV=production bundle exec rake assets:precompile
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
EXPOSE 3000

View file

@ -1,6 +1,6 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV)
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
end
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')

View file

@ -1,6 +1,6 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV)
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
end
APP_PATH = File.expand_path('../config/application', __dir__)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV)
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
end
require_relative '../config/boot'
require 'rake'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV)
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

View file

@ -11,8 +11,9 @@ services:
build: .
environment:
DATABASE_USERNAME: root
DATABASE_PASSWORD_EMPTY: 1
volumes:
- ${VOLUME:-.:/app}
- ${VOLUME:-.:/app}:Z
ports:
- 3000:3000
depends_on:

View file

@ -5,7 +5,12 @@ export DATABASE_NAME=${DATABASE_NAME:-tracks}
export DATABASE_HOST=${DATABASE_HOST:-db}
export DATABASE_PORT=${DATABASE_PORT:-3306}
export DATABASE_USERNAME=${DATABASE_USERNAME:-tracks}
export DATABASE_PASSWORD=${DATABASE_PASSWORD:-password}
if [ "$DATABASE_PASSWORD_EMPTY" != 1 ];
then
export DATABASE_PASSWORD=${DATABASE_PASSWORD:-password}
else
export DATABASE_PASSWORD=""
fi
export DATABASE_TYPE=${DATABASE_TYPE:-mysql2}
export DATABASE_ENCODING=${DATABASE_ENCODING:-utf8}