-
Notifications
You must be signed in to change notification settings - Fork 641
Build Docker image using rosco artifacts
Matt Duftler edited this page Jul 21, 2015
·
9 revisions
- Git cloning the spinnaker/rosco artifacts
- Capturing GCE account credentials (this is required to bake GCE images)
- Building the spinnaker/rosco image from Dockerfile
- Tagging the spinnaker/rosco image
- Pushing the spinnaker/rosco image
- Validating the packer template contained in the spinnaker/rosco image
- A Docker daemon and Docker registry running and accessible (the setup this page describes is sufficient: Run Docker on a GCE Container optimized VM)
Important: All of the following commands are to be executed on a machine that has the Docker daemon installed.
export DOCKER_IMAGE_NAME=spinnaker/rosco
export DOCKER_REGISTRY=localhost:5000
git clone https://github.com/spinnaker/rosco.git
or
git clone git@github.com:spinnaker/rosco.git
Create rosco/account.json file containing json key retrieved from Google Cloud Console->${Your Project}->APIs & auth->Credentials->Create new Client ID->Service account:
vi rosco/docker/account.json
Edit Dockerfile to allow launched containers to (insecurely) push to target docker registry. This should be the address of the docker registry you intend as the push target of baked docker images. Search for and replace the REPLACE_THIS_WITH_DOCKER_REGISTRY_HOST value:
vi rosco/docker/Dockerfile
cd rosco/docker
sudo docker build -t $DOCKER_IMAGE_NAME .
sudo docker tag $DOCKER_IMAGE_NAME $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME
sudo docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME
sudo docker run -i -t $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME bash
packer validate \
-var 'aws_access_key=FOO' \
-var 'aws_secret_key=BAR' \
-var 'aws_region=us-east-1' \
-var 'aws_ssh_username=ubuntu' \
-var 'aws_instance_type=t2.micro' \
-var 'aws_source_ami=ami-9eaa1cf6' \
-var 'aws_target_ami=some-packed-image' \
-var 'deb_repo=http://dl.bintray.com/spinnaker/ospackages ./' \
-var 'packages=redis-server' \
aws-ebs.json
packer validate \
-var 'gce_project_id=some-gcp-project' \
-var 'gce_zone=us-central1-f' \
-var 'gce_source_image=ubuntu-1404-trusty-v20141212' \
-var 'gce_target_image=some-packed-image' \
-var 'deb_repo=http://dl.bintray.com/spinnaker/ospackages' \
-var 'packages=redis-server' \
gce.json
packer validate \
-var 'docker_source_image=ubuntu:precise' \
-var 'docker_target_image=some-packed-image' \
-var 'docker_target_repository=some-registry:5000' \
-var 'deb_repo=http://dl.bintray.com/spinnaker/ospackages ./' \
-var 'packages=redis-server' \
docker.json
exit