initial import
This commit is contained in:
parent
897261a64b
commit
ccdae2bba6
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,8 +5,5 @@
|
|||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
|
|
||||||
# Test binary, build with `go test -c`
|
|
||||||
*.test
|
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
*.out
|
*.out
|
||||||
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM gcr.io/kaniko-project/executor:v0.6.0 AS kaniko
|
||||||
|
|
||||||
|
FROM alpine:3.8
|
||||||
|
|
||||||
|
# clone the official kaniko container into this one, env vars needs to be re-set
|
||||||
|
COPY --from=kaniko / /
|
||||||
|
ENV HOME /root
|
||||||
|
ENV USER /root
|
||||||
|
ENV SSL_CERT_DIR=/kaniko/ssl/certs
|
||||||
|
ENV DOCKER_CONFIG /kaniko/.docker/
|
||||||
|
ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json
|
||||||
|
|
||||||
|
# add the wrapper which acts as a drone plugin
|
||||||
|
COPY plugin.sh /usr/bin/
|
||||||
|
ENTRYPOINT [ "/usr/bin/plugin.sh" ]
|
5
Dockerfile.test
Normal file
5
Dockerfile.test
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM alpine:3.8
|
||||||
|
|
||||||
|
RUN apk add --update git
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/bin/plugin.sh" ]
|
10
README.md
10
README.md
@ -1 +1,9 @@
|
|||||||
# kaniko-plugin
|
# kaniko-plugin
|
||||||
|
|
||||||
|
A thin shim-wrapper around the official [Google Kaniko](https://cloud.google.com/blog/products/gcp/introducing-kaniko-build-container-images-in-kubernetes-and-google-container-builder-even-without-root-access) Docker image to make it behave like the [Drone Docker plugin](http://plugins.drone.io/drone-plugins/drone-docker/).
|
||||||
|
|
||||||
|
## Test that it can build itself
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it --rm -w /src -v $PWD:/src -e DOCKER_USERNAME=${DOCKER_USERNAME} -e DOCKER_PASSWORD=${DOCKER_PASSWORD} -e PLUGIN_REPO=banzaicloud/kaniko-plugin -e PLUGIN_TAG=test -e PLUGIN_DOCKERFILE=Dockerfile.test banzaicloud/kaniko-plugin
|
||||||
|
```
|
||||||
|
27
plugin.sh
Executable file
27
plugin.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export PATH=$PATH:/kaniko/
|
||||||
|
|
||||||
|
DOCKER_AUTH=`echo -n "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" | base64`
|
||||||
|
|
||||||
|
cat > /kaniko/.docker/config.json <<DOCKERJSON
|
||||||
|
{
|
||||||
|
"auths": {
|
||||||
|
"https://index.docker.io/v1/": {
|
||||||
|
"auth": "${DOCKER_AUTH}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DOCKERJSON
|
||||||
|
|
||||||
|
DOCKERFILE=${PLUGIN_DOCKERFILE:-Dockerfile}
|
||||||
|
DESTINATION=${PLUGIN_REPO}:${PLUGIN_TAGS:-latest}
|
||||||
|
CONTEXT=${PLUGIN_CONTEXT:-$PWD}
|
||||||
|
LOG=${PLUGIN_LOG:-info}
|
||||||
|
|
||||||
|
/kaniko/executor -v ${LOG} \
|
||||||
|
--context ${CONTEXT} \
|
||||||
|
--dockerfile ${DOCKERFILE} \
|
||||||
|
--destination ${DESTINATION}
|
Loading…
Reference in New Issue
Block a user