Skip to content

Commit

Permalink
Build archivesspace using docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-cooper committed Mar 9, 2015
0 parents commit f839cd4
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:trusty
MAINTAINER Mark Cooper <[email protected]>

ENV ARCHIVESSPACE_REPOSITORY https://github.com/archivesspace/archivesspace.git
ENV ARCHIVESSPACE_DB_TYPE demo
ENV ARCHIVESSPACE_DB_NAME archivesspace
ENV ARCHIVESSPACE_DB_USER archivesspace
ENV ARCHIVESSPACE_DB_PASS archivesspace

RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
git \
mysql-client \
openjdk-7-jre-headless \
wget \
unzip

RUN wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.24/mysql-connector-java-5.1.24.jar

RUN mkdir -p /source
RUN git clone $ARCHIVESSPACE_REPOSITORY /source/archivesspace

# PROCESS BUILD
WORKDIR /source/archivesspace
RUN ./scripts/build_release -t
RUN mv ./*.zip /
RUN rm -rf /source

# UNPACK BUILD
WORKDIR /
RUN unzip /*.zip -d /
RUN rm /*.zip
RUN rm -rf /archivesspace/plugins/*
RUN chmod 755 /archivesspace/archivesspace.sh

# FINALIZE SETUP
RUN cp /mysql-connector-java-5.1.24.jar /archivesspace/lib/
ADD plugins/ /archivesspace/plugins
ADD setup.sh /setup.sh
RUN chmod u+x /*.sh

EXPOSE 8080 8081 8089 8090

CMD ["/setup.sh"]
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Docker ArchivesSpace builds
---------------------------

**Automated builds**

- docker hub integration (build on push)
- also trigger from _archivesspace_/archivesspace to build on hub
- webhook from hub to deploy via docker on server (captain webhook)

**Manual builds**

Clone this repository, `cd` to it and:

```
docker build --no-cache --rm=true -t archivesspace/build:latest .
```

**Running**

Use `archivesspace/build:latest` in place of `markcooper/archivesspace-build` for local builds.

```
# background mode
docker run --name build -d \
-p 8080:8080 \
-p 8081:8081 \
-p 8089:8089 \
-p 8090:8090 \
markcooper/archivesspace-build
# foreground mode
docker run --name build -i -t \
-p 8080:8080 \
-p 8081:8081 \
-p 8089:8089 \
-p 8090:8090 \
markcooper/archivesspace-build
# foreground mode and access container
docker run --name build -i -t \
-p 8080:8080 \
-p 8081:8081 \
-p 8089:8089 \
-p 8090:8090 \
markcooper/archivesspace-build /bin/bash
```

**With MySQL**

```
# pull and run the official mysql docker image
docker run -d \
-p 3306:3306 \
--name mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=archivesspace \
-e MYSQL_USER=archivesspace \
-e MYSQL_PASSWORD=archivesspace \
mysql
# foreground mode
docker run --name build -i -t \
-p 8080:8080 \
-p 8081:8081 \
-p 8089:8089 \
-p 8090:8090 \
-e ARCHIVESSPACE_DB_TYPE=mysql \
--link mysql:db \
markcooper/archivesspace-build
```

---
2 changes: 2 additions & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
15 changes: 15 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cat /dev/null > /archivesspace/config/config.rb

if [[ "$ARCHIVESSPACE_DB_TYPE" == "mysql" ]]; then
echo "AppConfig[:db_url] = 'jdbc:mysql://$DB_PORT_3306_TCP_ADDR:3306/$ARCHIVESSPACE_DB_NAME?user=$ARCHIVESSPACE_DB_USER&password=$ARCHIVESSPACE_DB_PASS&useUnicode=true&characterEncoding=UTF-8'" \
>> /archivesspace/config/config.rb
/archivesspace/scripts/setup-database.sh
fi

for PLUGIN in /archivesspace/plugins/*; do
[[ -d $PLUGIN ]] && echo "AppConfig[:plugins] << '${PLUGIN##*/}'" >> /archivesspace/config/config.rb
done

exec /archivesspace/archivesspace.sh

0 comments on commit f839cd4

Please sign in to comment.