diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..261fc25
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,33 @@
+ARG RUBY_VERSION=3.2.2
+
+FROM rubylang/ruby:$RUBY_VERSION-dev-jammy
+
+RUN apt update && apt -y install \
+ imagemagick \
+ zip \
+ ghostscript \
+ libpng-dev \
+ graphicsmagick \
+ ffmpeg \
+ libreoffice \
+ git \
+ dcraw \
+ libyaml-dev
+
+RUN mkdir -p /opt/kakadu/downloads
+RUN wget http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip -O /opt/kakadu/downloads/kakadu.zip \
+ && unzip /opt/kakadu/downloads/kakadu.zip \
+ && mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kakadu \
+ && cp kakadu/*.so /usr/lib \
+ && cp kakadu/* /usr/bin
+
+RUN sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read|write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml
+RUN sed -i 's/decode="dng:decode" command=".*"\/>$/decode="dng:decode" command="\"\;dcraw\"\; -c -q 3 -H 5 -w \"\;\%i\"\; \| \"\;convert\"\; - \"\;\%u\.png\"\;"\/>/' /etc/ImageMagick-6/delegates.xml
+
+RUN addgroup --system --gid 1001 app && \
+ adduser --system --ingroup app --uid 1001 --shell /bin/sh --home /app app
+
+RUN mkdir -p /app/samvera/hydra-derviatives
+WORKDIR /app/samvera/hydra-derivatives
+COPY ./ /app/samvera/hydra-derivatives
+RUN gem install bundler && bundle install --jobs=3 --retry=3
diff --git a/README.md b/README.md
index 759c9bd..b447138 100644
--- a/README.md
+++ b/README.md
@@ -253,6 +253,32 @@ If you don't want to run the whole suite all at once like CI, do the following:
1. Run the test servers with `rake derivatives:test_server`
2. Run the tests.
+## Running tests with Docker
+
+First, make sure you have installed [Docker](https://www.docker.com/).
+
+Within your cloned repository, tell Docker to get started installing your development environment:
+
+```sh
+docker compose build
+docker compose up
+```
+
+This starts containers for:
+
+ - Fedora
+ - Solr
+
+It also builds an image containing all dependencies needed for the tests.
+
+To stop the containers, type Ctrl+c. To restart the containers you need only run `docker compose up`.
+
+You can run the full test suite using the following command:
+
+```sh
+docker compose run -w /app/samvera/hydra-derivatives test sh -c "bundle exec rspec"
+```
+
# Acknowledgments
This software has been developed by and is brought to you by the Samvera community. Learn more at the
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..5fbe682
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,46 @@
+version: '2.2'
+
+volumes:
+ solr:
+ fcrepo:
+
+networks:
+ internal:
+
+services:
+
+ solr:
+ image: solr:8
+ ports:
+ - 8985:8983
+ command:
+ - bash
+ - "-c"
+ - "precreate-core hydra-test /opt/solr/server/configsets/hydra-test; exec solr -f"
+ volumes:
+ - .:/app
+ - ./solr/config:/opt/solr/server/configsets/hydra-test
+ - solr:/opt/solr/server/solr
+ networks:
+ internal:
+
+ fcrepo:
+ image: ghcr.io/samvera/fcrepo4:4.7.5
+ volumes:
+ - fcrepo:/data:cached
+ ports:
+ - 8986:8080
+ networks:
+ internal:
+
+ test:
+ build: .
+ env_file:
+ - test.env
+ volumes:
+ - .:/app/samvera/hydra-derivatives # Volume mounted
+ networks:
+ internal:
+ depends_on:
+ - fcrepo
+ - solr
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6bc9c14..4ef7130 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -26,6 +26,7 @@
ActiveFedora::Cleaner.clean!
end
end
+ActiveFedora.init(fedora_config_path: ENV['FCREPO_CONFIG_PATH']) if ENV['FCREPO_CONFIG_PATH']
# Workaround for RAW image support until these are pushed upstream to
# the MIME Types gem
diff --git a/spec/support/config/fedora.yml b/spec/support/config/fedora.yml
new file mode 100644
index 0000000..dfdd3e6
--- /dev/null
+++ b/spec/support/config/fedora.yml
@@ -0,0 +1,15 @@
+development:
+ user: fedoraAdmin
+ password: fedoraAdmin
+ url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8984 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
+ base_path: <%= ENV['FCREPO_DEV_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/dev' %>
+test:
+ user: fedoraAdmin
+ password: fedoraAdmin
+ url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8986 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
+ base_path: <%= ENV['FCREPO_TEST_BASE_PATH'] || ENV['FCREPO_BASE_PATH'] || '/test' %>
+production:
+ user: fedoraAdmin
+ password: fedoraAdmin
+ url: http://<%= ENV['FCREPO_HOST'] || 'localhost' %>:<%= ENV['FCREPO_DEVELOPMENT_PORT'] || ENV['FCREPO_PORT'] || 8983 %>/<%= ENV['FCREPO_REST_PATH'] || 'rest' %>
+ base_path: <%= ENV['FCREPO_BASE_PATH'] || '/prod' %>
diff --git a/spec/support/config/solr.yml b/spec/support/config/solr.yml
new file mode 100644
index 0000000..66d1160
--- /dev/null
+++ b/spec/support/config/solr.yml
@@ -0,0 +1,7 @@
+# This is a sample config file that points to a solr server for each environment
+development:
+ url: <%= ENV['SOLR_DEVELOPMENT_URL'] || ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_DEVELOPMENT_PORT', 8983)}/solr/hydra-development" %>
+test:
+ url: <%= ENV['SOLR_TEST_URL'] || ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_TEST_PORT', 8985)}/solr/hydra-test" %>
+production:
+ url: <%= ENV['SOLR_URL'] || "http://your.production.server:8080/bl_solr/core0" %>
diff --git a/test.env b/test.env
new file mode 100644
index 0000000..48d1c3f
--- /dev/null
+++ b/test.env
@@ -0,0 +1,9 @@
+FCREPO_HOST=fcrepo
+FCREPO_PORT=8080
+FCREPO_REST_PATH=rest
+FCREPO_TEST_BASE_PATH=/test
+SOLR_HOST=solr
+SOLR_PORT=8983
+SOLR_TEST_URL=http://solr:8983/solr/hydra-test
+SOLR_URL=http://solr:8983/solr/
+FCREPO_CONFIG_PATH=spec/support/config/fedora.yml