File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -43,23 +43,30 @@ def scan_rails_app
4343
4444 ### database ###
4545
46+ # start by checkout config/database.yml. It defaults to sqlite3,
47+ # but we can't rely on that because DATABASE_URL can override it.
48+ # if we see anything else, assume the change was intentional.
4649 database = YAML . load_file ( "config/database.yml" , aliases : true ) .
4750 dig ( "production" , "adapter" ) rescue nil
4851
49- if database == "sqlite3"
50- @sqlite3 = true
51- elsif database == "postgresql"
52+ if database == "postgresql"
5253 @postgresql = true
5354 elsif ( database == "mysql" ) || ( database == "mysql2" ) || ( database == "trilogy" )
5455 @mysql = true
5556 elsif database == "sqlserver"
5657 @sqlserver = true
57- end
5858
59- @sqlite3 = true if @gemfile . include? "sqlite3"
60- @postgresql = true if @gemfile . include? "pg"
61- @mysql = true if @gemfile . include? ( "mysql2" ) || using_trilogy?
62- @sqlserver = true if @gemfile . include? ( "activerecord-sqlserver-adapter" )
59+ ## if not found (or sqlite3), check the Gemfile
60+ elsif @gemfile . include? "pg"
61+ @postgresql = true
62+ elsif @gemfile . include? ( "mysql2" ) || using_trilogy?
63+ @mysql = true
64+ elsif @gemfile . include? ( "activerecord-sqlserver-adapter" )
65+ @sqlserver = true
66+ elsif @gemfile . include? "sqlite3" || database == "sqlite3"
67+ # check this one last as sqlite3 may be used in development
68+ @sqlite3 = true
69+ end
6370
6471 ### node modules ###
6572
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \
2020
2121# Install base packages
2222RUN apt-get update -qq && \
23- apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 sqlite3 && \
23+ apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 && \
2424 rm -rf /var/lib/apt/lists /var/cache/apt/archives
2525
2626# Set production environment
@@ -35,7 +35,7 @@ FROM base AS build
3535
3636# Install packages needed to build gems
3737RUN apt-get update -qq && \
38- apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \
38+ apt-get install --no-install-recommends -y build-essential libyaml-dev && \
3939 rm -rf /var/lib/apt/lists /var/cache/apt/archives
4040
4141# Install application gems
You can’t perform that action at this time.
0 commit comments