docker

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

Drone Docker Plugin

CI Docker Image Version (tag latest semver) Docker Image Size (tag) codecov Go Report Card GoDoc

Drone plugin fork which uses Docker-in-Docker to build and publish Docker Linux amd64 images only to a Container Registry.
This is just a fork for personal use with additional custom features. However you can always refer to official repository uptream.

This repository has made the following changes:

  • Stripped all non-Linux amd64 stuff
  • Latest Go v1.16
  • All dependencies up-to-date.

Additional Features

  • Auto tag aliases support via auto_tag_aliases list that can be used along with auto_tag.

For the original plugin features check out the drone-plugins docs.

Pipeline example

Note that a Drone pipeline should be configured with privileged: true.

- name: publish
  image: joseluisq/drone-docker
  pull: always
  # Privileged mode required
  privileged: true
  settings:
    repo: joseluisq/drone-docker
    dockerfile: Dockerfile
    username:
      from_secret: username
    password:
      from_secret: password
    auto_tag: true
    # Additional auto tag aliases
    auto_tag_aliases:
      - latest

Test

make test

Build

Build the binaries with the following commands:

make build

Docker

Build

Build the Docker image with the following commands:

make image-build
Run

Notice: Be aware that the Docker plugin currently requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.

make image-dryrun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateStringSlice

func DeduplicateStringSlice(stringSlice []string) []string

DeduplicateStringSlice makes string slice deduplication in-place (comparable) Adapted from https://github.com/golang/go/wiki/SliceTricks#in-place-deduplicate-comparable

func DefaultTagSuffix

func DefaultTagSuffix(ref, suffix string) ([]string, error)

DefaultTagSuffix returns a set of default suggested tags based on the commit ref with an attached suffix.

func DefaultTags

func DefaultTags(ref string) ([]string, error)

DefaultTags returns a set of default suggested tags based on the commit ref.

func UseDefaultTag

func UseDefaultTag(ref, defaultBranch string) bool

UseDefaultTag for keep only default branch for latest tag

Types

type Build

type Build struct {
	Remote      string   // Git remote URL
	Name        string   // Docker build using default named tag
	Dockerfile  string   // Docker build Dockerfile
	Context     string   // Docker build context
	Tags        []string // Docker build tags
	Args        []string // Docker build args
	ArgsEnv     []string // Docker build args from env
	Target      string   // Docker build target
	Squash      bool     // Docker build squash
	Pull        bool     // Docker build pull
	CacheFrom   []string // Docker build cache-from
	Compress    bool     // Docker build compress
	Repo        string   // Docker build repository
	LabelSchema []string // label-schema Label map
	Labels      []string // Label map
	NoCache     bool     // Docker build no-cache
	AddHost     []string // Docker build add-host
	Quiet       bool     // Docker build quiet
}

Build defines Docker build parameters.

type Daemon

type Daemon struct {
	Registry      string   // Docker registry
	Mirror        string   // Docker registry mirror
	Insecure      bool     // Docker daemon enable insecure registries
	StorageDriver string   // Docker daemon storage driver
	StoragePath   string   // Docker daemon storage path
	Disabled      bool     // Docker daemon is disabled (already running)
	Debug         bool     // Docker daemon started in debug mode
	Bip           string   // Docker daemon network bridge IP address
	DNS           []string // Docker daemon dns server
	DNSSearch     []string // Docker daemon dns search domain
	MTU           string   // Docker daemon mtu setting
	IPv6          bool     // Docker daemon IPv6 networking
	Experimental  bool     // Docker daemon enable experimental mode
}

Daemon defines Docker daemon parameters.

type Login

type Login struct {
	Registry string // Docker registry address
	Username string // Docker registry username
	Password string // Docker registry password
	Email    string // Docker registry email
	Config   string // Docker Auth Config
}

Login defines Docker login parameters.

type Plugin

type Plugin struct {
	Login   Login  // Docker login configuration
	Build   Build  // Docker build configuration
	Daemon  Daemon // Docker daemon configuration
	Dryrun  bool   // Docker push is skipped
	Cleanup bool   // Docker purge is enabled
}

Plugin defines the Docker plugin parameters.

func (Plugin) Exec

func (p Plugin) Exec() error

Exec executes the plugin step

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL