• This repository has been archived on 22/Jun/2021
  • Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⚠️ This repository is deprecated and has been replaced by docker/build-push-action@v2

Deprecated

This repository is being replaced with docker/build-push-action@v2 which includes significant changes and now uses Docker Buildx. It will not receive any future updates, please update your workflows.

Upgrade notes with many usage examples have been added to handle most use cases.

About

The core code base for Docker's GitHub Actions (https://github.com/features/actions). This code is used to build the docker/github-actions image that provides the functionality used by the published Docker GitHub Action:

github-actions runs a command line tool that shells out to docker to perform the various functions. Parameters are supplied to github-actions using environment variables in the form described by the GitHub Actions documentation. github-actions uses some of the default GitHub Actions environment variables as described in the individual commands section.

Commands

Commands can be called using docker run docker/github-actions {command}

login

Does a docker login using the supplied username and password. Will default to Docker Hub but can be supplied a server address to login to a third-party registry as required.

inputs

Environment Variable Required Description
INPUT_USERNAME yes Username to login with
INPUT_PASSWORD yes Password to login with
INPUT_REGISTRY no Registry server to login to. Defaults to Docker Hub

build

Builds and tags a docker image.

inputs

Environment Variable Required Description
INPUT_PATH yes Path to build from
INPUT_DOCKERFILE no Path to Dockerfile
INPUT_ADD_GIT_LABELS no Adds git labels (see below)
INPUT_TARGET no Target build stage to build
INPUT_BUILD_ARGS no Comma-delimited list of build-args
INPUT_LABELS no Comma-delimited list of labels
INPUT_CACHE_FROMS no Comma-delimited list of cache-froms

See the tagging section for information on tag inputs

Git labels

When INPUT_ADD_GIT_LABELS is true labels are automatically added to the image that contain data about the current state of the git repo based on the standards set out in https://github.com/opencontainers/image-spec/blob/master/annotations.md.

3 labels are supported:

Label Description
org.opencontainers.image.created Date and time on which the image was built (string, date-time as defined by RFC 3339).
org.opencontainers.image.source URL to this repository. E.g. https://github.com/myorg/myrepository
org.opencontainers.image.revision The full git sha of this commit.

push

Pushes a docker image.

inputs

See the tagging section for information on tag inputs

build-push

Builds, logs in, and pushes a docker image.

inputs

Same as the login and build commands with the addition of

Environment Variable Required Description
INPUT_PUSH no Will push the image if true

Tagging

Tagging of images can be set manually, left to github-actions to automate, or a combination of the both.

There are 4 input variables used for tagging

Environment Variable Required Description
INPUT_REGISTRY no Registry server to tag with
INPUT_REPOSITORY yes Repository to tag with
INPUT_TAGS no Hard coded comma-delimited list of tags
INPUT_TAG_WITH_REF no If true then github-actions will add tags depending on the git ref automatically as described below
INPUT_TAG_WITH_SHA no If true then github-actions will add a tag in the form sha-{git-short-sha}

If INPUT_REGISTRY is set then all tags are prefixed with {INPUT_REGISTRY}/{INPUT_REPOSITORY}:. If not then all tags are prefixed with {INPUT_REPOSITORY}:

Auto tags depend on the git reference that the run is associated with. The reference is passed to github-actions using the GitHub actions GITHUB_REF enviroment variable.

If the reference is refs/heads/{branch-name} then the tag {branch-name} is added. For the master branch the {branch-name} is replaced with latest.

If the reference is refs/pull/{pr} then the tag pr-{pr} is added.

If the reference is refs/tags/{tag-name} then the tag {tag-name} is added.

Any / in the auto tags are replaced with -.

For example if the environment variables are as follows:

Variable Value
INPUT_REGISTRY
INPUT_REPOSITORY myorg/myimage
INPUT_TAGS foo,bar
INPUT_TAG_WITH_REF true
GITHUB_REF refs/tags/v0.1

Then the image will be tagged with:

myorg/myimage:foo
myorg/myimage:bar
myorg/myimage:v0.1

If the variables are as follows:

Variable Value
INPUT_REGISTRY myregistry
INPUT_REPOSITORY myorg/myimage
INPUT_TAGS foo,bar
INPUT_TAG_WITH_REF true
INPUT_TAG_WITH_SHA true
GITHUB_REF refs/heads/master
GITHUB_SHA c6df8c68eb71799f9c9ab4a4a4650d6aabd7e415

Then the image will be tagged with:

myregistry/myorg/myimage:foo
myregistry/myorg/myimage:bar
myregistry/myorg/myimage:lastest
myregistry/myorg/myimage:sha-c6df8c6

Building github-actions

The code is written in Go v1.13 with go mod. It can be built locally using the Makefile or in docker using the docker.Makefile.

make -f docker.Makefile will build the code, check the linting using golangci-lint, run the go tests, and build the image with a tag of docker/github-actions:latest

make -f docker.Makefile image will build the github-actions image without a tag and without running test or lint checking

make -f docker.Makefile cli will build the cli and copy it to ./bin/github-actions

make -f docker.Makefile test will run the unit and e2e tests

More Repositories

1

awesome-compose

Awesome Docker Compose samples
HTML
34,762
star
2

compose

Define and run multi-container applications with Docker
Go
33,472
star
3

kitematic

Visual Docker Container Management on Mac & Windows
JavaScript
12,247
star
4

labs

This is a collection of tutorials for learning how to use Docker with various tools. Contributions welcome.
PHP
11,518
star
5

docker-bench-security

The Docker Bench for Security is a script that checks for dozens of common best-practices around deploying Docker containers in production.
Shell
9,038
star
6

dockercraft

Docker + Minecraft = Dockercraft
Lua
7,185
star
7

docker-py

A Python library for the Docker Engine API
Python
6,800
star
8

machine

Machine management for a container-centric world
Go
6,628
star
9

cli

The Docker CLI
Go
4,850
star
10

build-push-action

GitHub Action to build and push Docker images with Buildx
TypeScript
4,242
star
11

docs

Source repo for Docker's Documentation
Markdown
4,163
star
12

genai-stack

Langchain + Docker + Neo4j + Ollama
Python
3,907
star
13

buildx

Docker CLI plugin for extended build capabilities with BuildKit
Go
3,513
star
14

getting-started

Getting started with Docker
JavaScript
2,911
star
15

libchan

Like Go channels over the network
Go
2,470
star
16

for-mac

Bug reports for Docker Desktop for Mac
2,426
star
17

docker-install

Docker installation script
Shell
2,281
star
18

for-win

Bug reports for Docker Desktop for Windows
1,849
star
19

roadmap

Welcome to the Public Roadmap for All Things Docker! We welcome your ideas.
1,734
star
20

app

Make your Docker Compose applications reusable, and share them on Docker Hub
Go
1,575
star
21

compose-on-kubernetes

Deploy applications described in Compose onto Kubernetes clusters
Go
1,419
star
22

docker-credential-helpers

Programs to keep Docker login credentials safe by storing in platform keystores
Go
1,060
star
23

login-action

GitHub Action to login against a Docker registry
TypeScript
1,029
star
24

setup-buildx-action

GitHub Action to set up Docker Buildx
TypeScript
933
star
25

metadata-action

GitHub Action to extract metadata (tags, labels) from Git reference and GitHub events for Docker
TypeScript
888
star
26

libkv

Distributed key/value store abstraction library
Go
854
star
27

for-linux

Docker Engine for Linux
751
star
28

libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
Go
585
star
29

setup-qemu-action

GitHub Action to install QEMU static binaries
TypeScript
431
star
30

welcome-to-docker

JavaScript
422
star
31

go-plugins-helpers

Go helper packages to extend the Docker Engine
Go
331
star
32

hub-tool

🧪 Docker Hub experimental CLI tool
Go
330
star
33

community

326
star
34

scout-cli

Docker Scout CLI
Shell
290
star
35

engine-api

DEPRECATED: Please see https://github.com/docker/docker/tree/master/client
Go
265
star
36

hub-feedback

Feedback and bug reports for the Docker Hub
233
star
37

doodle

A Home for Docker Doodles
Go
221
star
38

go-units

Parse and print size and time units in human-readable format
Go
215
star
39

go-connections

Utility package to work with network connections
Go
212
star
40

compose-switch

Go
199
star
41

go-docker

(Still WIP) Official Go SDK for Docker
Go
189
star
42

scan-cli-plugin

Docker Scan is a Command Line Interface to run vulnerability detection on your Dockerfiles and Docker images
Go
181
star
43

bake-action

GitHub Action to use Docker Buildx Bake as a high-level build command
TypeScript
176
star
44

gordon

Cli application to manage github pull requests
Go
176
star
45

docker-ce-packaging

Packaging scripts for Docker CE
Makefile
174
star
46

sbom-cli-plugin

Plugin for Docker CLI to support SBOM creation using Syft
Go
153
star
47

extensions-sdk

Desktop Extensions SDK
142
star
48

hacktoberfest-2022

Docker Hacktoberfest 2022
140
star
49

go-events

Composable event distribution for Go
Go
131
star
50

node-sdk

Docker CLI gRPC JavaScript SDK
JavaScript
110
star
51

libtrust

Primitives for identity and authorization
Go
107
star
52

compose-ecs

Deploy compose application on ECS
Go
100
star
53

golang-cross

Dockerfile
97
star
54

getting-started-app

A simple application for the getting started guide in Docker's documentation
JavaScript
93
star
55

multi-container-app

EJS
88
star
56

volumes-backup-extension

Back up, clone, restore, and share Docker volumes effortlessly.
PLpgSQL
87
star
57

go-metrics

Package for metrics collection in Docker projects
Go
87
star
58

scout-action

Docker Scout GitHub Action
JavaScript
78
star
59

desktop-linux

Bug reports for Docker Desktop for Linux
76
star
60

containerd-packaging

Linux distro packaging for containerd
Shell
68
star
61

opensource

Contains documentation and scripts related to the management of Open Source at Docker
Go
63
star
62

dev-environments

63
star
63

actions-toolkit

Toolkit for Docker (GitHub) Actions
TypeScript
58
star
64

extension-ideas

A place to suggest new ideas for Docker Extensions and get new ideas of what to build for the larger Docker community
48
star
65

binfmt

Please use https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt instead of this repo
Go
44
star
66

dev-envs-extension

TypeScript
40
star
67

code-of-conduct

40
star
68

index-cli-plugin

Go
40
star
69

whalesay

A repository in support of the Docker's official whalesay image
Perl
39
star
70

labs-make-runbook

TypeScript
38
star
71

HttpOverStream

.NET library for using HTTP 1.1 over streams, especially Windows Named Pipes
C#
33
star
72

scout-demo-service

Dockerfile
33
star
73

buildkit-syft-scanner

BuildKit Syft scanner
Go
23
star
74

get-involved

Get Involved with Docker
CSS
23
star
75

getting-started-todo-app

Sample application to get started with Docker
JavaScript
23
star
76

babashka-pod-docker

Go
20
star
77

packaging

Docker Packaging (apk, deb, rpm, static)
Dockerfile
20
star
78

buildx-desktop

19
star
79

cli-docs-tool

Utilities to generate (reference) documentation for the docker CLI
Go
19
star
80

docker-nodejs-sample

A simple Node.js application for the guide in Docker's documentation
JavaScript
18
star
81

go

Go packages with small patches autogenerated (used for canonical/json)
Go
18
star
82

base-cli-plugin

Experimental Docker CLI plugin to detect base images
Go
16
star
83

notary-official-images

Shell
16
star
84

python-docker

A simple Python app for the Python Language Guide in Docker's Docs
Python
16
star
85

go-imageinspect

Go
15
star
86

docker-dotnet-sample

A simple .NET web application
HTML
14
star
87

github-actions-runner

Docker's containerized github-actions runner
Shell
13
star
88

labs-ai-tools-for-devs

Project AI For Devs (chat-sdlc) - AI agents running containerized tools
Clojure
13
star
89

dc23-secure-workshop

DockerCon 2023 Secure Development with Docker hands-on exercises code
Dockerfile
11
star
90

extensions-submissions

Submit your Docker Extension here
Shell
11
star
91

docker-php-sample

A simple PHP application
PHP
10
star
92

docker-vscode

The Docker VSCode EAP is an extension for VSCode which provides an early preview into new features by Docker.
10
star
93

python-docker-dev

A simple Python app for the Python Language Guide in Docker's Docs
Python
10
star
94

import-restrictions

Restrict imports in your go project
Go
9
star
95

desktop-action

Docker Desktop action
9
star
96

labs-tape

Tape is for packaging applications
Go
8
star
97

engine-sync

Sync moby/moby with docker/engine
Shell
8
star
98

database-extension

TypeScript
7
star
99

bindmount-apps

EJS
7
star
100

compose-desktop

5
star