github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/packer/README.markdown (about)

     1  # Garden-Linux Packer #
     2  
     3  Garden-Linux Packer is currently used to build Docker images / Vagrant boxes
     4  suitable for Garden-Linux development & testing.
     5  
     6  ## Pre-requisites for Mac
     7  
     8  * Boot2docker version
     9    [1.3.3](https://github.com/boot2docker/osx-installer/releases/tag/v1.3.3) (1.4
    10    and above does not work because of [this
    11    issue](https://github.com/mitchellh/packer/issues/1752))
    12  * Packer built from [source](https://github.com/mitchellh/packer) (latest
    13    master)
    14  
    15  ## Building
    16  
    17  For some reason the default temp dir for packer has issues with the boot2docker
    18  vm. In order to build images you will need to export the `TMPDIR`. For
    19  instance, if you are using [direnv](http://direnv.net/) add this to a `.envrc`
    20  in the packer directory:
    21  
    22  ```bash
    23  export TMPDIR=~/.packer_tmp
    24  mkdir -p $TMPDIR
    25  ```
    26  
    27  ###Build everything
    28  
    29  Run `make ubuntu`. This will output a virtual-box `.ovf` and vagrant `.box` to
    30  `garden-ci/output` and commit a docker image to your Docker server named
    31  `garden-ci-ubuntu:packer`.
    32  
    33  ### Build Individual Images
    34    * Docker: `make ubuntu-docker`
    35    * Vagrant: `make ubuntu-vagrant`
    36    * Amazon: `make ubuntu-ami`
    37  
    38  ## Releasing
    39  
    40  ### [Atlas](https://atlas.hashicorp.com/)
    41  
    42  Update `garden-ci/VAGRANT_VIRTUAL_BOX_VERSION` with the desired version number.
    43  
    44  Ensure that you have the correct environment varibles set.
    45  
    46  ```bash
    47  export GARDEN_PACKER_VAGRANT_BOX_TAG=<Box tag goes here> # optional, defaults to cloudfoundry/garden-ci-ubuntu
    48  export GARDEN_PACKER_ATLAS_TOKEN=<Token goes here>
    49  ```
    50  
    51  Then run `make release-vagrant`. This will build & upload vagrant box upto Atlas.
    52  
    53  ### [DockerHub](https://hub.docker.com/)
    54  
    55  Update `garden-ci/DOCKER_IMAGE_VERSION` with the desired version number.
    56  
    57  Ensure that you have the correct environment varibles set.
    58  
    59  ```bash
    60  export GARDEN_PACKER_DOCKER_USERNAME=<Docker user name>
    61  export GARDEN_PACKER_DOCKER_EMAIL=<Docker email>
    62  export GARDEN_PACKER_DOCKER_PASSWORD=<Docker password>
    63  export GARDEN_PACKER_DOCKER_REPO=<Docker repo to target> # optional, defaults to cloudfoundry/garden-ci-ubuntu
    64  ```
    65  
    66  Then run `make release-docker`. This will tag and upload the image to Docker Hub.
    67  
    68  ### [Amazon EC2](http://aws.amazon.com/ec2/)
    69  
    70  Since the ami exists on Amazon, there is no need to release it. We just need to
    71  record its Image Id so that builds will use it and make the ami public.
    72  
    73  Store the Image id of the ami in the file `garden-ci/AMI_IMAGE_ID` and commit
    74  and push.
    75  
    76  Make the ami public (see [Making an AMI Public](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-intro.html):
    77  ```bash
    78  aws ec2 describe-image-attribute --image-id <Image Id> --attribute launchPermission
    79  ```
    80  
    81  TODO
    82