Skip to content

Instantly share code, notes, and snippets.

@jgmize
Created September 1, 2016 04:38
Show Gist options
  • Save jgmize/12379859b6f72b7661e588d4cbbbae3f to your computer and use it in GitHub Desktop.
Save jgmize/12379859b6f72b7661e588d4cbbbae3f to your computer and use it in GitHub Desktop.
Jenkins demo deploy script
export UPDATE_DOCKER_IMAGES=true
export DOCKERFILE=bedrock_base
export DOCKER_REPOSITORY=mozorg/bedrock_base
./docker/jenkins/build_image.sh
export UPDATE_DOCKER_IMAGES=false
export DOCKERFILE=bedrock_code
export DOCKER_REPOSITORY=mozorg/bedrock_code
export FROM_DOCKER_REPOSITORY=mozorg/bedrock_base
./docker/jenkins/build_image.sh
export DOCKER_REPOSITORY=mozorg/bedrock_l10n
export FROM_DOCKER_REPOSITORY=mozorg/bedrock_code
docker/jenkins/include_l10n.sh
docker run ${DOCKER_REPOSITORY}:${GIT_COMMIT} bash -c "cp .bedrock_demo_env .env &&\
./manage.py migrate --noinput --database bedrock &&\
./manage.py rnasync &&\
./manage.py cron update_ical_feeds &&\
./manage.py cron cleanup_ical_events &&\
./manage.py cron update_tweets &&\
./manage.py update_product_details --database bedrock &&\
./manage.py update_externalfiles &&\
./manage.py update_security_advisories &&\
./manage.py runscript update_firefox_os_feeds &&\
rm .env"
docker cp $(docker ps -ql):/app/bedrock.db .
DOCKERFILE=Dockerfile-sqlite-${GIT_COMMIT}
cat <<EOF > ${DOCKERFILE}
FROM ${DOCKER_REPOSITORY}:${GIT_COMMIT}
COPY bedrock.db .
EOF
export FROM_DOCKER_REPOSITORY=mozorg/bedrock_demo
IMAGE=${FROM_DOCKER_REPOSITORY}:${GIT_COMMIT}
docker build -f ${DOCKERFILE} -t ${IMAGE} .
#TODO: push to docker hub?
export PRIVATE_REGISTRIES=localhost:5001
export DEIS_APPS=${DEIS_APPLICATION}
./docker/jenkins/push2privateregistries.sh
#TODO: consider using "deis apps | grep -c ${DEIS_APPLICATION}" instead of logic below
#if deis apps:create ${DEIS_APPLICATION} --no-remote; then
# deis config:push -a ${DEIS_APPLICATION} -p .bedrock_demo_env
# #TODO: grant permissions to committer if applicable
#fi
deis pull ${DEIS_APPLICATION}:${GIT_COMMIT} -a ${DEIS_APPLICATION}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment