Initial kaniko docker
This commit is contained in:
commit
aaed706917
9
.github/issue_template.md
vendored
Normal file
9
.github/issue_template.md
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!-- PLEASE READ BEFORE DELETING
|
||||||
|
|
||||||
|
Bugs or Issues? Due to the high number of false positive issues we receive,
|
||||||
|
please do not create a GitHub issue until you have discussed and verified
|
||||||
|
with community support at:
|
||||||
|
|
||||||
|
https://discourse.drone.io/
|
||||||
|
|
||||||
|
-->
|
1
.github/pull_request_template.md
vendored
Normal file
1
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
69
.github/settings.yml
vendored
Normal file
69
.github/settings.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
repository:
|
||||||
|
name: drone-docker
|
||||||
|
description: Drone plugin for publishing Docker images
|
||||||
|
homepage: http://plugins.drone.io/drone-plugins/drone-docker
|
||||||
|
topics: drone, drone-plugin
|
||||||
|
|
||||||
|
private: false
|
||||||
|
has_issues: true
|
||||||
|
has_wiki: false
|
||||||
|
has_downloads: false
|
||||||
|
|
||||||
|
default_branch: master
|
||||||
|
|
||||||
|
allow_squash_merge: true
|
||||||
|
allow_merge_commit: true
|
||||||
|
allow_rebase_merge: true
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- name: bug
|
||||||
|
color: d73a4a
|
||||||
|
description: Something isn't working
|
||||||
|
- name: duplicate
|
||||||
|
color: cfd3d7
|
||||||
|
description: This issue or pull request already exists
|
||||||
|
- name: enhancement
|
||||||
|
color: a2eeef
|
||||||
|
description: New feature or request
|
||||||
|
- name: good first issue
|
||||||
|
color: 7057ff
|
||||||
|
description: Good for newcomers
|
||||||
|
- name: help wanted
|
||||||
|
color: 008672
|
||||||
|
description: Extra attention is needed
|
||||||
|
- name: invalid
|
||||||
|
color: e4e669
|
||||||
|
description: This doesn't seem right
|
||||||
|
- name: question
|
||||||
|
color: d876e3
|
||||||
|
description: Further information is requested
|
||||||
|
- name: renovate
|
||||||
|
color: e99695
|
||||||
|
description: Automated action from Renovate
|
||||||
|
- name: wontfix
|
||||||
|
color: ffffff
|
||||||
|
description: This will not be worked on
|
||||||
|
|
||||||
|
teams:
|
||||||
|
- name: Admins
|
||||||
|
permission: admin
|
||||||
|
|
||||||
|
branches:
|
||||||
|
- name: master
|
||||||
|
protection:
|
||||||
|
required_pull_request_reviews:
|
||||||
|
required_approving_review_count: 1
|
||||||
|
dismiss_stale_reviews: false
|
||||||
|
require_code_owner_reviews: false
|
||||||
|
dismissal_restrictions:
|
||||||
|
teams:
|
||||||
|
- Admins
|
||||||
|
required_status_checks:
|
||||||
|
strict: true
|
||||||
|
contexts:
|
||||||
|
- continuous-integration/drone/pr
|
||||||
|
enforce_admins: false
|
||||||
|
restrictions:
|
||||||
|
users: []
|
||||||
|
teams:
|
||||||
|
- Admins
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
release
|
||||||
|
coverage.out
|
||||||
|
vendor
|
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
74
README.md
Normal file
74
README.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# drone-docker
|
||||||
|
|
||||||
|
[![Build Status](http://cloud.drone.io/api/badges/drone-plugins/drone-docker/status.svg)](http://cloud.drone.io/drone-plugins/drone-docker)
|
||||||
|
[![Gitter chat](https://badges.gitter.im/drone/drone.png)](https://gitter.im/drone/drone)
|
||||||
|
[![Join the discussion at https://discourse.drone.io](https://img.shields.io/badge/discourse-forum-orange.svg)](https://discourse.drone.io)
|
||||||
|
[![Drone questions at https://stackoverflow.com](https://img.shields.io/badge/drone-stackoverflow-orange.svg)](https://stackoverflow.com/questions/tagged/drone.io)
|
||||||
|
[![](https://images.microbadger.com/badges/image/plugins/docker.svg)](https://microbadger.com/images/plugins/docker "Get your own image badge on microbadger.com")
|
||||||
|
[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-docker?status.svg)](http://godoc.org/github.com/drone-plugins/drone-docker)
|
||||||
|
[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-docker)](https://goreportcard.com/report/github.com/drone-plugins/drone-docker)
|
||||||
|
|
||||||
|
Drone plugin uses Docker-in-Docker to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](http://plugins.drone.io/drone-plugins/drone-docker/).
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Build the binaries with the following commands:
|
||||||
|
|
||||||
|
```console
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GO111MODULE=on
|
||||||
|
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-docker ./cmd/drone-docker
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-gcr ./cmd/drone-gcr
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-ecr ./cmd/drone-ecr
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-acr ./cmd/drone-acr
|
||||||
|
go build -v -a -tags netgo -o release/linux/amd64/drone-heroku ./cmd/drone-heroku
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
Build the Docker images with the following commands:
|
||||||
|
|
||||||
|
```console
|
||||||
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/docker/Dockerfile.linux.amd64 --tag plugins/docker .
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/gcr/Dockerfile.linux.amd64 --tag plugins/gcr .
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/ecr/Dockerfile.linux.amd64 --tag plugins/ecr .
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/acr/Dockerfile.linux.amd64 --tag plugins/acr .
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
|
||||||
|
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
|
||||||
|
--file docker/heroku/Dockerfile.linux.amd64 --tag plugins/heroku .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
> Notice: Be aware that the Docker plugin currently requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
|
||||||
|
|
||||||
|
```console
|
||||||
|
docker run --rm \
|
||||||
|
-e PLUGIN_TAG=latest \
|
||||||
|
-e PLUGIN_REPO=octocat/hello-world \
|
||||||
|
-e DRONE_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
|
||||||
|
-v $(pwd):$(pwd) \
|
||||||
|
-w $(pwd) \
|
||||||
|
--privileged \
|
||||||
|
plugins/docker --dry-run
|
||||||
|
```
|
140
cmd/drone-docker/main.go
Normal file
140
cmd/drone-docker/main.go
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
docker "github.com/drone-plugins/drone-docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Docker config file path
|
||||||
|
dockerConfigPath string = "/kaniko/.docker/config.json"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
version = "unknown"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Load env-file if it exists first
|
||||||
|
if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" {
|
||||||
|
godotenv.Load(env)
|
||||||
|
}
|
||||||
|
|
||||||
|
app := cli.NewApp()
|
||||||
|
app.Name = "kaniko docker plugin"
|
||||||
|
app.Usage = "kaniko docker plugin"
|
||||||
|
app.Action = run
|
||||||
|
app.Version = version
|
||||||
|
app.Flags = []cli.Flag{
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "dockerfile",
|
||||||
|
Usage: "build dockerfile",
|
||||||
|
Value: "Dockerfile",
|
||||||
|
EnvVar: "PLUGIN_DOCKERFILE",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "context",
|
||||||
|
Usage: "build context",
|
||||||
|
Value: ".",
|
||||||
|
EnvVar: "PLUGIN_CONTEXT",
|
||||||
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "tags",
|
||||||
|
Usage: "build tags",
|
||||||
|
Value: &cli.StringSlice{"latest"},
|
||||||
|
EnvVar: "PLUGIN_TAGS",
|
||||||
|
FilePath: ".tags",
|
||||||
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "args",
|
||||||
|
Usage: "build args",
|
||||||
|
EnvVar: "PLUGIN_BUILD_ARGS",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "target",
|
||||||
|
Usage: "build target",
|
||||||
|
EnvVar: "PLUGIN_TARGET",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "repo",
|
||||||
|
Usage: "docker repository",
|
||||||
|
EnvVar: "PLUGIN_REPO",
|
||||||
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "custom-labels",
|
||||||
|
Usage: "additional k=v labels",
|
||||||
|
EnvVar: "PLUGIN_CUSTOM_LABELS",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "registry",
|
||||||
|
Usage: "docker registry",
|
||||||
|
Value: "https://index.docker.io/v1/",
|
||||||
|
EnvVar: "PLUGIN_REGISTRY",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "username",
|
||||||
|
Usage: "docker username",
|
||||||
|
EnvVar: "PLUGIN_USERNAME",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "password",
|
||||||
|
Usage: "docker password",
|
||||||
|
EnvVar: "PLUGIN_PASSWORD",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
logrus.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(c *cli.Context) error {
|
||||||
|
err := createDockerCfgFile(c.String("username"), c.String("password"), c.String("registry"))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin := docker.Plugin{
|
||||||
|
Build: docker.Build{
|
||||||
|
Dockerfile: c.String("dockerfile"),
|
||||||
|
Context: c.String("context"),
|
||||||
|
Tags: c.StringSlice("tags"),
|
||||||
|
Args: c.StringSlice("args"),
|
||||||
|
Target: c.String("target"),
|
||||||
|
Repo: c.String("repo"),
|
||||||
|
Labels: c.StringSlice("custom-labels"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return plugin.Exec()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the docker config file for authentication
|
||||||
|
func createDockerCfgFile(username, password, registry string) error {
|
||||||
|
if username == "" {
|
||||||
|
return fmt.Errorf("Username is not set")
|
||||||
|
}
|
||||||
|
if password == "" {
|
||||||
|
return fmt.Errorf("Password is not set")
|
||||||
|
}
|
||||||
|
if registry == "" {
|
||||||
|
return fmt.Errorf("Registry is not set")
|
||||||
|
}
|
||||||
|
|
||||||
|
authBytes := []byte(fmt.Sprintf("%s:%s", username, password))
|
||||||
|
encodedString := base64.StdEncoding.EncodeToString(authBytes)
|
||||||
|
jsonBytes := []byte(fmt.Sprintf(`{"auths": {"%s": {"auth": "%s"}}}`, registry, encodedString))
|
||||||
|
err := ioutil.WriteFile(dockerConfigPath, jsonBytes, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "failed to create docker config file")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
69
docker.go
Normal file
69
docker.go
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
// Build defines Docker build parameters.
|
||||||
|
Build struct {
|
||||||
|
Dockerfile string // Docker build Dockerfile
|
||||||
|
Context string // Docker build context
|
||||||
|
Tags []string // Docker build tags
|
||||||
|
Args []string // Docker build args
|
||||||
|
Target string // Docker build target
|
||||||
|
Repo string // Docker build repository
|
||||||
|
Labels []string // Label map
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plugin defines the Docker plugin parameters.
|
||||||
|
Plugin struct {
|
||||||
|
Build Build // Docker build configuration
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Exec executes the plugin step
|
||||||
|
func (p Plugin) Exec() error {
|
||||||
|
if p.Build.Repo == "" {
|
||||||
|
return fmt.Errorf("repository name to publish image must be specified")
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdArgs := []string{
|
||||||
|
fmt.Sprintf("--dockerfile=%s", p.Build.Dockerfile),
|
||||||
|
fmt.Sprintf("--context=dir://%s", p.Build.Context),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the destination repository
|
||||||
|
for _, tag := range p.Build.Tags {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--destination=%s:%s", p.Build.Repo, tag))
|
||||||
|
}
|
||||||
|
// Set the build arguments
|
||||||
|
for _, arg := range p.Build.Args {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--build-arg=%s", arg))
|
||||||
|
}
|
||||||
|
// Set the labels
|
||||||
|
for _, label := range p.Build.Labels {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--label %s", label))
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.Build.Target != "" {
|
||||||
|
cmdArgs = append(cmdArgs, fmt.Sprintf("--target=%s", p.Build.Target))
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.Command("/kaniko/executor", cmdArgs...)
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
trace(cmd)
|
||||||
|
|
||||||
|
err := cmd.Run()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// trace writes each command to stdout with the command wrapped in an xml
|
||||||
|
// tag so that it can be extracted and displayed in the logs.
|
||||||
|
func trace(cmd *exec.Cmd) {
|
||||||
|
fmt.Fprintf(os.Stdout, "+ %s\n", strings.Join(cmd.Args, " "))
|
||||||
|
}
|
7
docker/docker/Dockerfile.linux.amd64
Normal file
7
docker/docker/Dockerfile.linux.amd64
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM gcr.io/kaniko-project/executor:debug-v0.19.0
|
||||||
|
|
||||||
|
ENV HOME /root
|
||||||
|
ENV USER root
|
||||||
|
|
||||||
|
ADD release/linux/amd64/drone-docker /kaniko/
|
||||||
|
ENTRYPOINT ["/kaniko/drone-docker"]
|
6
docker/docker/Dockerfile.linux.arm
Normal file
6
docker/docker/Dockerfile.linux.arm
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM arm32v6/docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-docker /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
6
docker/docker/Dockerfile.linux.arm64
Normal file
6
docker/docker/Dockerfile.linux.arm64
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM arm64v8/docker:19.03.8-dind
|
||||||
|
|
||||||
|
ENV DOCKER_HOST=unix:///var/run/docker.sock
|
||||||
|
|
||||||
|
ADD release/linux/arm64/drone-docker /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"]
|
26
docker/docker/Dockerfile.windows.1803
Normal file
26
docker/docker/Dockerfile.windows.1803
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1803 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 18.09.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM plugins/base:windows-1803
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
27
docker/docker/Dockerfile.windows.1809
Normal file
27
docker/docker/Dockerfile.windows.1809
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1809 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 18.09.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.6-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/windows/nanoserver:1809
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
28
docker/docker/Dockerfile.windows.1903
Normal file
28
docker/docker/Dockerfile.windows.1903
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1903 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 19.03.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/windows/nanoserver:1903
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
RUN mkdir C:\bin
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
28
docker/docker/Dockerfile.windows.1909
Normal file
28
docker/docker/Dockerfile.windows.1909
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM mcr.microsoft.com/windows/servercore:1909 as download
|
||||||
|
|
||||||
|
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||||
|
|
||||||
|
ENV DOCKER_VERSION 19.03.1
|
||||||
|
|
||||||
|
RUN Invoke-WebRequest 'http://constexpr.org/innoextract/files/innoextract-1.7-windows.zip' -OutFile 'innoextract.zip' -UseBasicParsing ; `
|
||||||
|
Expand-Archive innoextract.zip -DestinationPath C:\ ; `
|
||||||
|
Remove-Item -Path innoextract.zip
|
||||||
|
|
||||||
|
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||||
|
Invoke-WebRequest $('https://github.com/docker/toolbox/releases/download/v{0}/DockerToolbox-{0}.exe' -f $env:DOCKER_VERSION) -OutFile 'dockertoolbox.exe' -UseBasicParsing
|
||||||
|
RUN /innoextract.exe dockertoolbox.exe
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/windows/nanoserver:1909
|
||||||
|
USER ContainerAdministrator
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone Docker" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
RUN mkdir C:\bin
|
||||||
|
COPY --from=download /windows/system32/netapi32.dll /windows/system32/netapi32.dll
|
||||||
|
COPY --from=download /app/docker.exe C:/bin/docker.exe
|
||||||
|
ADD release/windows/amd64/drone-docker.exe C:/bin/drone-docker.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-docker.exe" ]
|
49
docker/docker/manifest.tmpl
Normal file
49
docker/docker/manifest.tmpl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1903
|
||||||
|
-
|
||||||
|
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1909
|
4
docker/ecr/Dockerfile.linux.amd64
Normal file
4
docker/ecr/Dockerfile.linux.amd64
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-amd64
|
||||||
|
|
||||||
|
ADD release/linux/amd64/drone-ecr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]
|
4
docker/ecr/Dockerfile.linux.arm
Normal file
4
docker/ecr/Dockerfile.linux.arm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-ecr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]
|
4
docker/ecr/Dockerfile.linux.arm64
Normal file
4
docker/ecr/Dockerfile.linux.arm64
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm64
|
||||||
|
|
||||||
|
ADD release/linux/arm64/drone-ecr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"]
|
10
docker/ecr/Dockerfile.windows.1803
Normal file
10
docker/ecr/Dockerfile.windows.1803
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1803
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone ECR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]
|
10
docker/ecr/Dockerfile.windows.1809
Normal file
10
docker/ecr/Dockerfile.windows.1809
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1809
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone ECR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-ecr.exe C:/bin/drone-ecr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-ecr.exe" ]
|
37
docker/ecr/manifest.tmpl
Normal file
37
docker/ecr/manifest.tmpl
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
|
-
|
||||||
|
image: plugins/ecr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
4
docker/gcr/Dockerfile.linux.amd64
Normal file
4
docker/gcr/Dockerfile.linux.amd64
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-amd64
|
||||||
|
|
||||||
|
ADD release/linux/amd64/drone-gcr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]
|
4
docker/gcr/Dockerfile.linux.arm
Normal file
4
docker/gcr/Dockerfile.linux.arm
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm
|
||||||
|
|
||||||
|
ADD release/linux/arm/drone-gcr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]
|
4
docker/gcr/Dockerfile.linux.arm64
Normal file
4
docker/gcr/Dockerfile.linux.arm64
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM plugins/docker:linux-arm64
|
||||||
|
|
||||||
|
ADD release/linux/arm64/drone-gcr /bin/
|
||||||
|
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"]
|
10
docker/gcr/Dockerfile.windows.1803
Normal file
10
docker/gcr/Dockerfile.windows.1803
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1803
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone GCR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]
|
10
docker/gcr/Dockerfile.windows.1809
Normal file
10
docker/gcr/Dockerfile.windows.1809
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# escape=`
|
||||||
|
FROM plugins/docker:windows-1809
|
||||||
|
|
||||||
|
LABEL maintainer="Drone.IO Community <drone-dev@googlegroups.com>" `
|
||||||
|
org.label-schema.name="Drone GCR" `
|
||||||
|
org.label-schema.vendor="Drone.IO Community" `
|
||||||
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ADD release/windows/amd64/drone-gcr.exe C:/bin/drone-gcr.exe
|
||||||
|
ENTRYPOINT [ "C:\\bin\\drone-gcr.exe" ]
|
37
docker/gcr/manifest.tmpl
Normal file
37
docker/gcr/manifest.tmpl
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||||
|
{{#if build.tags}}
|
||||||
|
tags:
|
||||||
|
{{#each build.tags}}
|
||||||
|
- {{this}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
manifests:
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: linux
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||||
|
platform:
|
||||||
|
architecture: arm64
|
||||||
|
os: linux
|
||||||
|
variant: v8
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||||
|
platform:
|
||||||
|
architecture: arm
|
||||||
|
os: linux
|
||||||
|
variant: v7
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1803
|
||||||
|
-
|
||||||
|
image: plugins/gcr:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809
|
||||||
|
platform:
|
||||||
|
architecture: amd64
|
||||||
|
os: windows
|
||||||
|
version: 1809
|
1
docker_test.go
Normal file
1
docker_test.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package docker
|
14
go.mod
Normal file
14
go.mod
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module github.com/drone-plugins/drone-docker
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/aws/aws-sdk-go v1.26.7
|
||||||
|
github.com/coreos/go-semver v0.2.0
|
||||||
|
github.com/joho/godotenv v1.3.0
|
||||||
|
github.com/pkg/errors v0.9.1
|
||||||
|
github.com/sirupsen/logrus v1.3.0
|
||||||
|
github.com/urfave/cli v1.22.2
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e // indirect
|
||||||
|
golang.org/x/text v0.3.0 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
|
go 1.13
|
44
go.sum
Normal file
44
go.sum
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg=
|
||||||
|
github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||||
|
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
|
||||||
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
|
||||||
|
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||||
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||||
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||||
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
|
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
|
||||||
|
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||||
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
|
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
|
||||||
|
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
|
||||||
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||||
|
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
|
||||||
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
Loading…
Reference in New Issue
Block a user