Skip to content

Commit

Permalink
Merge pull request #400 from trym-b/feat/add-docker-template
Browse files Browse the repository at this point in the history
feat: add `Dockerfile` template
  • Loading branch information
thomasegense authored Aug 17, 2023
2 parents 083e8cf + 5d073d0 commit 525aec8
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Test"

on:
push:

jobs:
build-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build SolrWayback Docker image
run: docker build --tag solrwayback .
61 changes: 61 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This dockerfile sets up the SolrWayback bundle and attempts to run both Solr and Tomcat.
# To build the image, run:
# docker build . --tag solrwayback

# To run SolrWayback, you need to launch it with the following parameters
# docker run --publish 8080:8080 --publish 8983:8983 --volume <path/to/WARCs>:/host_dir --tty --interactive solrwayback bash
# where <path/to/WARCs> is a file path that only contains WARC files and directories.

# When the container is running, run the following commands to start Solr and Tomcat:
# export SOLRWAYBACK_VERSION=4.4.2
# export APACHE_TOMCAT_VERSION=8.5.60
# export SOLR_VERSION=7.7.3
# ./unpacked-bundle/solrwayback_package_$SOLRWAYBACK_VERSION/solr-$SOLR_VERSION/bin/solr start
# ./unpacked-bundle/solrwayback_package_$SOLRWAYBACK_VERSION/apache-tomcat-$APACHE_TOMCAT_VERSION/bin/startup.sh

# You should now verify that the following links works with a browser:
# http://localhost:8080/solrwayback/
# http://localhost:8983/solr/#/

# If you have some WARC files you want to index, you can index them with the following commands:
# WARC_FILES=$(find /host_dir/ -type f)
# ./unpacked-bundle/solrwayback_package_$SOLRWAYBACK_VERSION/indexing/warc-indexer.sh $WARC_FILES

FROM ubuntu:22.04

ENV SOLRWAYBACK_VERSION 4.4.2
ENV APACHE_TOMCAT_VERSION 8.5.60
ENV SOLR_VERSION 7.7.3

RUN apt-get update --assume-yes --quiet
RUN apt-get install wget unzip --assume-yes --quiet

# Install dependencies
RUN apt-get install default-jre lsof curl --assume-yes --quiet

RUN useradd --create-home --shell /bin/bash builder
RUN chown builder:builder /home/builder -R

USER builder
WORKDIR /home/builder

# Download and unpack SolrWayback bundle
RUN mkdir --parents solrwayback-zip
RUN wget --quiet https://github.com/netarchivesuite/solrwayback/releases/download/${SOLRWAYBACK_VERSION}/solrwayback_package_${SOLRWAYBACK_VERSION}.zip \
--output-document solrwayback-zip/bundle.zip

RUN mkdir unpacked-bundle
RUN unzip -q solrwayback-zip/bundle.zip -d unpacked-bundle
RUN rm --recursive solrwayback-zip

# Set up SolrWayback configuration
RUN cp unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/properties/solrwayback.properties .
RUN cp unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/properties/solrwaybackweb.properties .

# Verify that apache-tomcat works
RUN unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/apache-tomcat-${APACHE_TOMCAT_VERSION}/bin/startup.sh
RUN unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/apache-tomcat-${APACHE_TOMCAT_VERSION}/bin/shutdown.sh

# Verify that solr works
RUN unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/solr-${SOLR_VERSION}/bin/solr start
RUN unpacked-bundle/solrwayback_package_${SOLRWAYBACK_VERSION}/solr-${SOLR_VERSION}/bin/solr stop -all
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ Documents in SolrWayback are indexed through the [warc-indexer](https://github.c


## Build and test with Docker
Currently disabled as docker image has not been maintained.

A containerized sample can be found [here](./Dockerfile)

## Contact
Thomas Egense ([email protected])
Expand Down

0 comments on commit 525aec8

Please sign in to comment.