#
# The contents of this file are subject to the license and copyright
# detailed in the LICENSE and NOTICE files at the root of the source
# tree and available online at
#
# http://www.dspace.org/license/
#

version: "3.7"

services:
  dspace-cli:
    environment:
    - AIPZIP=https://github.com/DSpace-Labs/AIP-Files/raw/master/dogAndReport.zip
    - ADMIN_EMAIL=test@test.edu
    - AIPDIR=/tmp/aip-dir
    entrypoint:
      - /bin/bash
      - '-c'
      - |
          rm -rf $${AIPDIR}
          mkdir $${AIPDIR} /dspace/upload
          cd $${AIPDIR}
          pwd
          curl $${AIPZIP} -L -s --output aip.zip
          unzip aip.zip
          cd $${AIPDIR}

          /dspace/bin/dspace packager -r -a -t AIP -e $${ADMIN_EMAIL} -f -u SITE*.zip
          /dspace/bin/dspace database update-sequences
          touch /dspace/solr/search/conf/reindex.flag

          /dspace/bin/dspace oai import
          /dspace/bin/dspace oai clean-cache
