kopia lustrzana https://github.com/jupyterhub/repo2docker
testing addition of DOCKER_TAG instead of latest
rodzic
c3e6fb68cb
commit
9d3725d9d0
|
@ -4,9 +4,11 @@ jobs:
|
||||||
# If you want to deploy your container to Docker Hub, you must
|
# If you want to deploy your container to Docker Hub, you must
|
||||||
# 1. define the CONTAINER_NAME environment variable for the project
|
# 1. define the CONTAINER_NAME environment variable for the project
|
||||||
# If not defined, will use the repo that is being built from.
|
# If not defined, will use the repo that is being built from.
|
||||||
# 2. define the REPO_NAME with the juypter notebook you want to build. If not
|
# 2. Define the DOCKER_TAG if you have preference. If not defined, will use
|
||||||
|
# the commit associated with the build.
|
||||||
|
# 3. define the REPO_NAME with the juypter notebook you want to build. If not
|
||||||
# defined, will use https://www.github.com/{CONTAINER_NAME}
|
# defined, will use https://www.github.com/{CONTAINER_NAME}
|
||||||
# 2. Also define DOCKER_USER and DOCKER_PASS (for deploy, if wanted)
|
# 4. Also define DOCKER_USER and DOCKER_PASS (for deploy, if wanted)
|
||||||
setup:
|
setup:
|
||||||
environment:
|
environment:
|
||||||
- TZ: "/usr/share/zoneinfo/America/Los_Angeles"
|
- TZ: "/usr/share/zoneinfo/America/Los_Angeles"
|
||||||
|
@ -59,6 +61,11 @@ jobs:
|
||||||
echo "repo2docker version: ${VERSION}"
|
echo "repo2docker version: ${VERSION}"
|
||||||
echo "1. Preparing building environment"
|
echo "1. Preparing building environment"
|
||||||
echo "Working directory is ${PWD}"
|
echo "Working directory is ${PWD}"
|
||||||
|
# If not set, define DOCKER_TAG
|
||||||
|
if [ ! -n "${DOCKER_TAG:-}" ]
|
||||||
|
then
|
||||||
|
DOCKER_TAG=$(echo "${CIRCLE_SHA1}" | cut -c1-10)
|
||||||
|
fi
|
||||||
# If not set, define CONTAINER_NAME
|
# If not set, define CONTAINER_NAME
|
||||||
if [ ! -n "${CONTAINER_NAME:-}" ]
|
if [ ! -n "${CONTAINER_NAME:-}" ]
|
||||||
then
|
then
|
||||||
|
@ -82,14 +89,19 @@ jobs:
|
||||||
name: Docker Save
|
name: Docker Save
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 40m
|
||||||
command: |
|
command: |
|
||||||
|
# If not set, use commit id as tag
|
||||||
|
if [ ! -n "${DOCKER_TAG:-}" ]
|
||||||
|
then
|
||||||
|
DOCKER_TAG=$(echo "${CIRCLE_SHA1}" | cut -c1-10)
|
||||||
|
fi
|
||||||
# If not set, define CONTAINER_NAME
|
# If not set, define CONTAINER_NAME
|
||||||
if [ ! -n "${CONTAINER_NAME:-}" ]
|
if [ ! -n "${CONTAINER_NAME:-}" ]
|
||||||
then
|
then
|
||||||
CONTAINER_NAME="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
|
CONTAINER_NAME="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
|
||||||
fi
|
fi
|
||||||
echo "Saving ${CONTAINER_NAME} to container.tar.gz"
|
echo "Saving ${CONTAINER_NAME}:${DOCKER_TAG} to container.tar.gz"
|
||||||
mkdir -p /tmp/cache
|
mkdir -p /tmp/cache
|
||||||
docker save ${CONTAINER_NAME}:latest \
|
docker save ${CONTAINER_NAME}:${DOCKER_TAG} \
|
||||||
| pigz -2 -p 3 > /tmp/cache/container.tar.gz
|
| pigz -2 -p 3 > /tmp/cache/container.tar.gz
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: /tmp
|
root: /tmp
|
||||||
|
@ -134,15 +146,19 @@ jobs:
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 40m
|
||||||
command: |
|
command: |
|
||||||
echo "Looking for Docker deployment options"
|
echo "Looking for Docker deployment options"
|
||||||
|
if [ ! -n "${DOCKER_TAG:-}" ]
|
||||||
|
then
|
||||||
|
DOCKER_TAG=$(echo "${CIRCLE_SHA1}" | cut -c1-10)
|
||||||
|
fi
|
||||||
# If not set, define CONTAINER_NAME
|
# If not set, define CONTAINER_NAME
|
||||||
if [[ ! -n "${CONTAINER_NAME:-}" ]]
|
if [[ ! -n "${CONTAINER_NAME:-}" ]]
|
||||||
then
|
then
|
||||||
CONTAINER_NAME="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
|
CONTAINER_NAME="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
|
||||||
fi
|
fi
|
||||||
echo "Container name set to ${CONTAINER_NAME}"
|
echo "Container name set to ${CONTAINER_NAME}:${DOCKER_TAG}"
|
||||||
if [[ -n "$DOCKER_PASS" ]]; then
|
if [[ -n "$DOCKER_PASS" ]]; then
|
||||||
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||||
docker push ${CONTAINER_NAME}:latest
|
docker push ${CONTAINER_NAME}:${DOCKER_TAG}
|
||||||
fi
|
fi
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
|
@ -54,8 +54,9 @@ name to get to your project settings. Under settings, click on the "Environment
|
||||||
Variables" tab. In this section, you want to define the following:
|
Variables" tab. In this section, you want to define the following:
|
||||||
|
|
||||||
1. ``CONTAINER_NAME`` should be the name of the Docker Hub repository you just created.
|
1. ``CONTAINER_NAME`` should be the name of the Docker Hub repository you just created.
|
||||||
2. ``DOCKER_USER`` and ``DOCKER_PASS`` should be your credentials (to allowing pushing)
|
2. ``DOCKER_TAG`` is the tag you want to use. If not defined, will use first 10 characters of commit.
|
||||||
3. ``REPO_NAME`` should be the full Github url (or other) of the repository with the notebook.
|
3. ``DOCKER_USER`` and ``DOCKER_PASS`` should be your credentials (to allowing pushing)
|
||||||
|
4. ``REPO_NAME`` should be the full Github url (or other) of the repository with the notebook.
|
||||||
|
|
||||||
If you don't define the ``CONTAINER_NAME`` it will default to be the repository where it is
|
If you don't define the ``CONTAINER_NAME`` it will default to be the repository where it is
|
||||||
building from, which you should only do if the Docker Hub repository is named equivalently.
|
building from, which you should only do if the Docker Hub repository is named equivalently.
|
||||||
|
|
Ładowanie…
Reference in New Issue