Skip to content
Permalink
Browse files

Merge pull request #416 from alexarchambault/more-lightweight-docker-…

…image

Use jupyter/base-notebook as base docker image
  • Loading branch information...
alexarchambault committed Aug 13, 2019
2 parents b2967f8 + 1641398 commit c6e16ca78a949ff249fcb50376739cc9ea575e26
Showing with 27 additions and 7 deletions.
  1. +22 −2 Dockerfile
  2. +5 −5 scripts/update-docker-images.sh
@@ -6,12 +6,32 @@
# Can be used to create an image with a locally built almond that isn't on maven central yet.
ARG LOCAL_IVY=no

FROM almondsh/almond:coursier as local_ivy_yes
FROM jupyter/base-notebook as coursier_base

USER root

RUN apt-get -y update && \
apt-get install --no-install-recommends -y \
curl \
openjdk-8-jre-headless \
ca-certificates-java && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN curl -Lo /usr/local/bin/coursier https://github.com/coursier/coursier/releases/download/v2.0.0-RC3-2/coursier && \
chmod +x /usr/local/bin/coursier

USER $NB_UID

# ensure the JAR of the CLI is in the coursier cache, in the image
RUN /usr/local/bin/coursier --help

FROM coursier_base as local_ivy_yes
USER $NB_UID
ONBUILD RUN mkdir -p .ivy2/local/
ONBUILD COPY --chown=1000:100 ivy-local/ .ivy2/local/

FROM almondsh/almond:coursier as local_ivy_no
FROM coursier_base as local_ivy_no

FROM local_ivy_${LOCAL_IVY}
ARG ALMOND_VERSION
@@ -2,7 +2,7 @@
set -e

SCALA212_VERSION="$(grep -oP '(?<=def scala212 = ")[^"]*(?<!")' project/Settings.scala)"
SCALA211_VERSION="$(grep -oP '(?<=def scala211 = ")[^"]*(?<!")' project/Settings.scala)"
SCALA213_VERSION="$(grep -oP '(?<=def scala213 = ")[^"]*(?<!")' project/Settings.scala)"

ALMOND_VERSION="$(git describe --tags --abbrev=0 --match 'v*' | sed 's/^v//')"

@@ -17,19 +17,19 @@ if [[ ${TRAVIS_TAG} != v* ]]; then
sbt 'set version in ThisBuild := "'${ALMOND_VERSION}'"' '+ publishLocal'
cp -r $HOME/.ivy2/local/ ivy-local/
docker build --build-arg ALMOND_VERSION=${ALMOND_VERSION} --build-arg=LOCAL_IVY=yes \
--build-arg SCALA_VERSIONS="$SCALA211_VERSION $SCALA212_VERSION" -t ${IMAGE_NAME} .
--build-arg SCALA_VERSIONS="$SCALA213_VERSION $SCALA212_VERSION" -t ${IMAGE_NAME} .
docker push ${IMAGE_NAME}
else
echo "Creating release images for almond ${ALMOND_VERSION}"
IMAGE_NAME=${DOCKER_REPO}:${ALMOND_VERSION}
docker build --build-arg ALMOND_VERSION=${ALMOND_VERSION} \
--build-arg SCALA_VERSIONS="$SCALA211_VERSION $SCALA212_VERSION" -t ${IMAGE_NAME} .
--build-arg SCALA_VERSIONS="$SCALA213_VERSION $SCALA212_VERSION" -t ${IMAGE_NAME} .
docker build --build-arg ALMOND_VERSION=${ALMOND_VERSION} \
--build-arg SCALA_VERSIONS="$SCALA211_VERSION" -t ${IMAGE_NAME}-scala-${SCALA211_VERSION} .
--build-arg SCALA_VERSIONS="$SCALA213_VERSION" -t ${IMAGE_NAME}-scala-${SCALA213_VERSION} .
docker build --build-arg ALMOND_VERSION=${ALMOND_VERSION} \
--build-arg SCALA_VERSIONS="$SCALA212_VERSION" -t ${IMAGE_NAME}-scala-${SCALA212_VERSION} .

docker push ${IMAGE_NAME}-scala-${SCALA211_VERSION}
docker push ${IMAGE_NAME}-scala-${SCALA213_VERSION}
docker push ${IMAGE_NAME}-scala-${SCALA212_VERSION}
docker push ${IMAGE_NAME}
docker tag ${IMAGE_NAME} ${DOCKER_REPO}:latest

0 comments on commit c6e16ca

Please sign in to comment.
You can’t perform that action at this time.