Update readme (#230)

* update readme

* update readme
This commit is contained in:
priyawadhwa 2018-07-09 16:51:36 -04:00 committed by GitHub
parent 5f908efbf9
commit a80a7ded35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 15 deletions

View File

@ -41,26 +41,30 @@ kaniko does not support building Windows containers.
## Development ## Development
### kaniko Build Contexts ### kaniko Build Contexts
kaniko supports local directories and GCS buckets as build contexts. To specify a local directory, pass in the `--context` flag as an argument to the executor image. kaniko currently supports local directories, Google Cloud Storage and Amazon S3 as build contexts.
To specify a GCS bucket, pass in the `--bucket` flag. If using a GCS or S3 bucket, the bucket should contain a compressed tar of the build context, which kaniko will unpack and use.
The GCS bucket should contain a compressed tar of the build context called `context.tar.gz`, which kaniko will unpack and use as the build context.
To create `context.tar.gz`, run the following command: To create a compressed tar, you can run:
```shell ```shell
tar -C <path to build context> -zcvf context.tar.gz . tar -C <path to build context> -zcvf context.tar.gz .
``` ```
Then, copy over the compressed tar into your bucket.
Or, you can use [skaffold](https://github.com/GoogleContainerTools/skaffold) to create `context.tar.gz` by running For example, we can copy over the compressed tar to a GCS bucket with gsutil:
```
skaffold docker context
```
We can copy over the compressed tar to a GCS bucket with gsutil:
``` ```
gsutil cp context.tar.gz gs://<bucket name> gsutil cp context.tar.gz gs://<bucket name>
``` ```
Use the `--context` flag with the appropriate prefix to specify your build context:
| Source | Prefix |
|---------|---------|
| Local Directory | dir://[path to directory] |
| GCS Bucket | gs://[bucket name]/[path to .tar.gz] |
| S3 Bucket | s3://[bucket name]/[path to .tar.gz] |
If you don't specify a prefix, kaniko will assume a local directory.
For example, to use a GCS bucket called `kaniko-bucket`, you would pass in `--context=gs://kaniko-bucket/path/to/context.tar.gz`.
### Running kaniko in a Kubernetes cluster ### Running kaniko in a Kubernetes cluster
Requirements: Requirements:
@ -89,7 +93,7 @@ spec:
- name: kaniko - name: kaniko
image: gcr.io/kaniko-project/executor:latest image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=<path to Dockerfile>", args: ["--dockerfile=<path to Dockerfile>",
"--bucket=<GCS bucket>", "--context=gs://<GCS bucket>/<path to .tar.gz>",
"--destination=<gcr.io/$PROJECT/$IMAGE:$TAG>"] "--destination=<gcr.io/$PROJECT/$IMAGE:$TAG>"]
volumeMounts: volumeMounts:
- name: kaniko-secret - name: kaniko-secret
@ -129,7 +133,7 @@ To run kaniko in GCB, add it to your build config as a build step:
steps: steps:
- name: gcr.io/kaniko-project/executor:latest - name: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=<path to Dockerfile>", args: ["--dockerfile=<path to Dockerfile>",
"--context=<path to build context>", "--context=dir://<path to build context>",
"--destination=<gcr.io/$PROJECT/$IMAGE:$TAG>"] "--destination=<gcr.io/$PROJECT/$IMAGE:$TAG>"]
``` ```
kaniko will build and push the final image in this build step. kaniko will build and push the final image in this build step.
@ -191,7 +195,7 @@ spec:
- name: kaniko - name: kaniko
image: gcr.io/kaniko-project/executor:latest image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=<path to Dockerfile>", args: ["--dockerfile=<path to Dockerfile>",
"--context=<path to build context>", "--context=s3://<bucket name>/<path to .tar.gz>",
"--destination=<aws_account_id.dkr.ecr.region.amazonaws.com/my-repository:my-tag>"] "--destination=<aws_account_id.dkr.ecr.region.amazonaws.com/my-repository:my-tag>"]
volumeMounts: volumeMounts:
- name: aws-secret - name: aws-secret