Skip to content

Commit 316c83b

Browse files
committed
Fix spinning up BL instance using docker-compose up
`docker-compose up` is failing to spin up a BL instance for various reasons. This commit makes the following changes * Adds the `shared-mime-info` lib so that bundle install will not fail. * Adds yarn so that `webpacker assets:precompile` does not fail * Adds .dockerignore to ignore files that can pollute docker instance with local Gemfile.lock etc. * Updates the default ruby and rails version to avoid no method deep_transform_values on Hash error * Updates with_solr rake method to stop rake task frown downloading a solr zip file when solr docker instance is already available via docker-compose * Add ENGINE_CART_RAILS_OPTIONS environment to dockerfile-compose.yml app config to avoid solr_wrapper from being invoked by the solr_wrapper engine (same reason as above) * Stop mounting . from app to avoid seg fault and also stop polluting instance with host's Gemfile.lock and host's .internal_test_app
1 parent 6293071 commit 316c83b

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

.docker/app/Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ RUN apk add --update --no-cache \
99
libxml2-dev \
1010
libxslt-dev \
1111
nodejs \
12+
shared-mime-info \
1213
sqlite-dev \
13-
tzdata
14+
tzdata \
15+
yarn
1416

1517
RUN mkdir /app
1618
WORKDIR /app

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Gemfile.lock
2+
.internal_test_app
3+
.solr_wrapper.yml

.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ALPINE_RUBY_VERSION=2.6.5
2-
RAILS_VERSION=5.2.5
1+
ALPINE_RUBY_VERSION=3.0.3
2+
RAILS_VERSION=6.0.3.4
33
SOLR_PORT=8983
44
SOLR_URL=http://solr:8983/solr/blacklight-core
55
SOLR_VERSION=latest

docker-compose.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ services:
77
dockerfile: .docker/app/Dockerfile
88
args:
99
- ALPINE_RUBY_VERSION
10-
volumes:
11-
- .:/app
10+
# mounting . is causing seg-fault on macosx
11+
#volumes:
12+
#- .:/app
1213
depends_on:
1314
- solr
1415
ports:
1516
- "3000:3000"
1617
environment:
1718
- SOLR_URL # Set via environment variable or use default defined in .env file
1819
- RAILS_VERSION # Set via environment variable or use default defined in .env file
20+
- SOLR_ENV=docker-compose
21+
- ENGINE_CART_RAILS_OPTIONS=--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test --skip-solr
1922

2023
solr:
2124
environment:

tasks/blacklight.rake

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ def system_with_error_handling(*args)
2121
end
2222

2323
def with_solr(&block)
24-
if system('docker-compose -v')
24+
# We're being invoked by the app entrypoint script and solr is already up via docker-compose
25+
if ENV['SOLR_ENV'] == 'docker-compose'
26+
yield
27+
elsif system('docker-compose -v')
28+
# We're not running docker-compose up but still want to use a docker instance of solr.
2529
begin
2630
puts "Starting Solr"
2731
system_with_error_handling "docker-compose up -d solr"

0 commit comments

Comments
 (0)