Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Dev Show and Tell - Aug 28, 2018 - 1500UTC - DSpace On DockerHub

Open Issues

Issue 1 - Move Dockerfile into DSpace/DSpace and DSpace/DSpace-Angular & Assume the Dockerfile Context has a full instance of source code

This will reduce the need to retrieve source code from git, if the Dockerfile is already housed at the project root directory.

Pull requests

Code Block
titleCurrent Docker Strategy
FROM alpine/git as clone ARG DSPACE_BRANCH=dspace-6_x ENV DSPACE_GIT https://github.com/DSpace/DSpace.git WORKDIR /app RUN git clone ${DSPACE_GIT} \ && cd /app/DSpace \ && git checkout ${DSPACE_BRANCH} COPY local.cfg /app/DSpace COPY build.properties /app/DSpace FROM maven as build WORKDIR /app COPY --from=clone /app/DSpace /app RUN mvn package

The Docker build command takes a git url as a parameter.  See https://docs.docker.com/engine/reference/commandline/build/

Some experimentation is still needed to verify this.

Code Block
titleSimplified Docker Strategy - assumes the file resides in the Code base
FROM maven as build WORKDIR /app # Add the full source dir into the image ADD * /app/ COPY docker.local.cfg /app/local.cfg # In the DSpace 4/5 build COPY docker.build.properties /app/build.properties

This will likely require the creation of a .dockerignore file for times when the build is run from a user's desktop

Code Block
title.dockerignore
.git/ .idea/ .settings/ */target/ dspace/modules/*/target/

Issue 2 - Grant Docker Hub permissions within the DSpace GitHub organization

Terry has attempted to find another library tech open source project that has granted similar permissions.

Tim Donohue , do you know if one of the other DuraSpace projects has done this?

In the meantime, I am testing the automated build process here: https://hub.docker.com/r/terrywbrady/dspace/builds/ using a GitHub account with limited credentials.

Issue 3 - Docker Image Build Automation

Automate the creation of DSpace images as the DSpace/DSpace and DSpace/DSpace-Anuglar source code changes.

Option 1 - Create an Automated Build Trigger on Docker Hub

DockerHub allows you to configure builds based on source branches for a repository.

This is a supported solution.

Image Removed

Description

  • Each time one of the supported branches of DSpace is updated, update an image to Docker Hub.
  • Each time a release tag is created on GitHub, create a new image on Docker Hub.
  • It is unclear if images could be generated for each PR

...

Requirements

  • Move the Dockerfile from DSpace-Labs/DSpace-Docker-Images to DSpace/DSpace.
    • Customize 4x branch to look for custom target/install dir.
  • Grant DockerHub access to the DSpace GitHub org.
  • Consider a paid DockerHub account to expedite builds.  Otherwise, builds might queue up.
    • You can only trigger one build at a time and no more than one every five minutes. If you already have a build pending, or if you recently submitted a build request, Docker ignores new requests.

The following terminal output illustrates how easy it is to switch between DSpace versions

Option 1a - Use DockerCloud for the Automated Build

There may be a PR build option available through this service, but I am finding it difficult to understand when to use Docker Cloud vs Docker Hub.

https://docs.docker.com/docker-cloud/builds/automated-build/#customize-your-build-process

Option 2 - Add Docker Build Automation to Travis Build

This would likely be a home-grown solution and may not be fully supported.

https://ops.tips/blog/travis-ci-push-docker-image/

Description

  • Each time Travis rebuilds a branch, update an image to Docker Hub.
  • Each time Travis rebuilds a PR, update an image to Docker Hub
    • This may generate a lot of images, but it could simplify testing
  • Each time a release tag is created on GitHub, manually build a new image on Docker Hub.
    • Unless there is a way to trigger this in travis as well

...

Updated on each successful Travis build

...

Updated on each successful Travis build

...

Updated on each successful Travis build

...

Updated on each successful Travis build

...

Current Implementation

branchJDKtagDockerfile
master8master./Dockerfile
dspace-6_x8dspace-6_x./Dockerfile
dspace-5_x8dspace-5_x./Dockerfile
dspace-4_x8dspace-4_x./Dockerfile


Proposal: Support Multiple JDK Versions

branchJDKtagDockerfileNote
master8master-jdk8dspace/src/main/docker/jdk8
dspace-6_x8dspace-6_x-jdk8dspace/src/main/docker/jdk8
dspace-5_x8dspace-5_x-jdk8dspace/src/main/docker/jdk8
dspace-5_x7dspace-5_x-jdk7dspace/src/main/docker/jdk7
dspace-4_x8dspace-4_x-jdk8dspace/src/main/docker/jdk8
dspace-4_x7dspace-4_x-jdk7dspace/src/main/docker/jdk7

Requirements

  • Relocate the Dockerfile to source repo?
    • This may be needed
  • Create Docker Hub account for DSpace (user not org).  Embed Docker Hub user credentials within Travis.
  • Evaluate the performance impact on the Travis build
  • Determine any limitations on the number of images that can be pushed to Docker Hub

Issue 4 - Setting guidelines for team permissions on Docker Hub.

Currently, 4 users have admin rights to the DSpace Docker registry.

Consider granting image-specific permissions to particular teams.

Issue 5 - Exploring new opportunities built on DSpace images

The existence of published DSpace images might make it easier to host branch-specific DSpace images to facilitate PR testing and pre-release testing.

Currently, server level command line access is required to build and deploy a PR for testing.  This often limits the potential pool of testers to the developer community. 

If the deployment of a test environment for a PR could be automated, some user testing of PR's could be performed by repository managers and other users who do not have command line access t server resources.

Issue 6 - How should we be using Docker Labels within our Images

...



Additional Resources