Compare commits
	
		
			No commits in common. "master" and "v2.10.0" have entirely different histories.
		
	
	
		
	
		
@ -1,12 +1,2 @@
 | 
				
			|||||||
/coverage
 | 
					/coverage
 | 
				
			||||||
 | 
					/node_modules
 | 
				
			||||||
# Dependency directories
 | 
					 | 
				
			||||||
node_modules/
 | 
					 | 
				
			||||||
jspm_packages/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# yarn v2
 | 
					 | 
				
			||||||
.yarn/cache
 | 
					 | 
				
			||||||
.yarn/unplugged
 | 
					 | 
				
			||||||
.yarn/build-state.yml
 | 
					 | 
				
			||||||
.yarn/install-state.gz
 | 
					 | 
				
			||||||
.pnp.*
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +0,0 @@
 | 
				
			|||||||
/dist/**
 | 
					 | 
				
			||||||
/coverage/**
 | 
					 | 
				
			||||||
/node_modules/**
 | 
					 | 
				
			||||||
@ -1,24 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "env": {
 | 
					 | 
				
			||||||
    "node": true,
 | 
					 | 
				
			||||||
    "es6": true,
 | 
					 | 
				
			||||||
    "jest": true
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "extends": [
 | 
					 | 
				
			||||||
    "eslint:recommended",
 | 
					 | 
				
			||||||
    "plugin:@typescript-eslint/eslint-recommended",
 | 
					 | 
				
			||||||
    "plugin:@typescript-eslint/recommended",
 | 
					 | 
				
			||||||
    "plugin:jest/recommended",
 | 
					 | 
				
			||||||
    "plugin:prettier/recommended"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "parser": "@typescript-eslint/parser",
 | 
					 | 
				
			||||||
  "parserOptions": {
 | 
					 | 
				
			||||||
    "ecmaVersion": 2023,
 | 
					 | 
				
			||||||
    "sourceType": "module"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "plugins": [
 | 
					 | 
				
			||||||
    "@typescript-eslint",
 | 
					 | 
				
			||||||
    "jest",
 | 
					 | 
				
			||||||
    "prettier"
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -1,4 +1,2 @@
 | 
				
			|||||||
/.yarn/releases/** binary
 | 
					 | 
				
			||||||
/.yarn/plugins/** binary
 | 
					 | 
				
			||||||
/dist/** linguist-generated=true
 | 
					/dist/** linguist-generated=true
 | 
				
			||||||
/lib/** linguist-generated=true
 | 
					/lib/** linguist-generated=true
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.github/CODEOWNERS
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					*	@crazy-max
 | 
				
			||||||
							
								
								
									
										3
									
								
								.github/CODE_OF_CONDUCT.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/CODE_OF_CONDUCT.md
									
									
									
									
										vendored
									
									
								
							@ -1,3 +0,0 @@
 | 
				
			|||||||
# Code of conduct
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
 | 
					 | 
				
			||||||
							
								
								
									
										101
									
								
								.github/ISSUE_TEMPLATE/bug.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										101
									
								
								.github/ISSUE_TEMPLATE/bug.yml
									
									
									
									
										vendored
									
									
								
							@ -1,101 +0,0 @@
 | 
				
			|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
 | 
					 | 
				
			||||||
name: Bug Report
 | 
					 | 
				
			||||||
description: Report a bug
 | 
					 | 
				
			||||||
labels:
 | 
					 | 
				
			||||||
  - status/triage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
body:
 | 
					 | 
				
			||||||
  - type: markdown
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      value: |
 | 
					 | 
				
			||||||
        Thank you for taking the time to report a bug!
 | 
					 | 
				
			||||||
        If this is a security issue please report it to the [Docker Security team](mailto:security@docker.com).
 | 
					 | 
				
			||||||
        Before submitting a bug report, check out the [Troubleshooting doc](https://github.com/docker/build-push-action/blob/master/TROUBLESHOOTING.md).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: checkboxes
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Contributing guidelines
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Make sure you've read the contributing guidelines before proceeding.
 | 
					 | 
				
			||||||
      options:
 | 
					 | 
				
			||||||
        - label: I've read the [contributing guidelines](https://github.com/docker/build-push-action/blob/master/.github/CONTRIBUTING.md) and wholeheartedly agree
 | 
					 | 
				
			||||||
          required: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: checkboxes
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: "I've found a bug, and:"
 | 
					 | 
				
			||||||
      description: |
 | 
					 | 
				
			||||||
        Make sure that your request fulfills all of the following requirements.
 | 
					 | 
				
			||||||
        If one requirement cannot be satisfied, explain in detail why.
 | 
					 | 
				
			||||||
      options:
 | 
					 | 
				
			||||||
        - label: The documentation does not mention anything about my problem
 | 
					 | 
				
			||||||
        - label: There are no open or closed issues that are related to my problem
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Description
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Provide a brief description of the bug in 1-2 sentences.
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Expected behaviour
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Describe precisely what you'd expect to happen.
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Actual behaviour
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Describe precisely what is actually happening.
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: input
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Repository URL
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Enter the URL of the repository where you are experiencing the
 | 
					 | 
				
			||||||
        issue. If your repository is private, provide a link to a minimal
 | 
					 | 
				
			||||||
        repository that reproduces the issue.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: input
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Workflow run URL
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        Enter the URL of the GitHub Action workflow run, if public.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: YAML workflow
 | 
					 | 
				
			||||||
      description: |
 | 
					 | 
				
			||||||
        Provide the YAML of the workflow that's causing the issue.
 | 
					 | 
				
			||||||
        Make sure to remove any sensitive information.
 | 
					 | 
				
			||||||
      render: yaml
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Workflow logs
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        [Attach](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)
 | 
					 | 
				
			||||||
        the [log file of your workflow run](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
 | 
					 | 
				
			||||||
        and make sure to remove any sensitive information.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: BuildKit logs
 | 
					 | 
				
			||||||
      description: >
 | 
					 | 
				
			||||||
        If applicable, provide the [BuildKit container logs](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs)
 | 
					 | 
				
			||||||
      render: text
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Additional info
 | 
					 | 
				
			||||||
      description: |
 | 
					 | 
				
			||||||
        Provide any additional information that could be useful.
 | 
					 | 
				
			||||||
							
								
								
									
										37
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								.github/ISSUE_TEMPLATE/bug_report.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					name: Bug report
 | 
				
			||||||
 | 
					about: Create a report to help us improve
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Troubleshooting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Before submitting a bug report please read the [Troubleshooting doc](https://github.com/docker/build-push-action/blob/master/TROUBLESHOOTING.md).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Behaviour
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Steps to reproduce this issue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1.
 | 
				
			||||||
 | 
					2.
 | 
				
			||||||
 | 
					3.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Expected behaviour
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> Tell us what should happen
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Actual behaviour
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> Tell us what happens instead
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Configuration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Repository URL (if public): 
 | 
				
			||||||
 | 
					* Build URL (if public): 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yml
 | 
				
			||||||
 | 
					# paste your YAML workflow file here and remove sensitive data
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Logs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs) and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
 | 
				
			||||||
							
								
								
									
										9
									
								
								.github/ISSUE_TEMPLATE/config.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/ISSUE_TEMPLATE/config.yml
									
									
									
									
										vendored
									
									
								
							@ -1,9 +0,0 @@
 | 
				
			|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
 | 
					 | 
				
			||||||
blank_issues_enabled: true
 | 
					 | 
				
			||||||
contact_links:
 | 
					 | 
				
			||||||
  - name: Questions and Discussions
 | 
					 | 
				
			||||||
    url: https://github.com/docker/build-push-action/discussions/new
 | 
					 | 
				
			||||||
    about: Use Github Discussions to ask questions and/or open discussion topics.
 | 
					 | 
				
			||||||
  - name: Documentation
 | 
					 | 
				
			||||||
    url: https://docs.docker.com/build/ci/github-actions/
 | 
					 | 
				
			||||||
    about: Read the documentation.
 | 
					 | 
				
			||||||
							
								
								
									
										15
									
								
								.github/ISSUE_TEMPLATE/feature.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.github/ISSUE_TEMPLATE/feature.yml
									
									
									
									
										vendored
									
									
								
							@ -1,15 +0,0 @@
 | 
				
			|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
 | 
					 | 
				
			||||||
name: Feature request
 | 
					 | 
				
			||||||
description: Missing functionality? Come tell us about it!
 | 
					 | 
				
			||||||
labels:
 | 
					 | 
				
			||||||
  - kind/enhancement
 | 
					 | 
				
			||||||
  - status/triage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
body:
 | 
					 | 
				
			||||||
  - type: textarea
 | 
					 | 
				
			||||||
    id: description
 | 
					 | 
				
			||||||
    attributes:
 | 
					 | 
				
			||||||
      label: Description
 | 
					 | 
				
			||||||
      description: What is the feature you want to see?
 | 
					 | 
				
			||||||
    validations:
 | 
					 | 
				
			||||||
      required: true
 | 
					 | 
				
			||||||
							
								
								
									
										12
									
								
								.github/SECURITY.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/SECURITY.md
									
									
									
									
										vendored
									
									
								
							@ -1,12 +0,0 @@
 | 
				
			|||||||
# Reporting security issues
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The project maintainers take security seriously. If you discover a security
 | 
					 | 
				
			||||||
issue, please bring it to their attention right away!
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**Please _DO NOT_ file a public issue**, instead send your report privately to
 | 
					 | 
				
			||||||
[security@docker.com](mailto:security@docker.com).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Security reports are greatly appreciated, and we will publicly thank you for it.
 | 
					 | 
				
			||||||
We also like to send gifts—if you'd like Docker swag, make sure to let
 | 
					 | 
				
			||||||
us know. We currently do not offer a paid security bounty program, but are not
 | 
					 | 
				
			||||||
ruling it out in the future.
 | 
					 | 
				
			||||||
							
								
								
									
										31
									
								
								.github/SUPPORT.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								.github/SUPPORT.md
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					# Support [](https://isitmaintained.com/project/docker/build-push-action)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					First, [be a good guy](https://github.com/kossnocorp/etiquette/blob/master/README.md).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Reporting an issue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Please do a search in [open issues](https://github.com/docker/build-push-action/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:+1: - upvote
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:-1: - downvote
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Writing good bug reports and feature requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					File a single issue per problem and feature request.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Do not enumerate multiple bugs or feature requests in the same issue.
 | 
				
			||||||
 | 
					* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You are now ready to [create a new issue](https://github.com/docker/build-push-action/issues/new/choose)!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Closure policy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
 | 
				
			||||||
 | 
					* Issues that go a week without a response from original poster are subject to closure at our discretion.
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								.github/build-push-summary.png
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.github/build-push-summary.png
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 81 KiB  | 
							
								
								
									
										1
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							@ -11,7 +11,6 @@ updates:
 | 
				
			|||||||
    directory: "/"
 | 
					    directory: "/"
 | 
				
			||||||
    schedule:
 | 
					    schedule:
 | 
				
			||||||
      interval: "daily"
 | 
					      interval: "daily"
 | 
				
			||||||
    versioning-strategy: "increase"
 | 
					 | 
				
			||||||
    allow:
 | 
					    allow:
 | 
				
			||||||
      - dependency-type: "production"
 | 
					      - dependency-type: "production"
 | 
				
			||||||
    labels:
 | 
					    labels:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								.github/e2e/distribution/env
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/e2e/distribution/env
									
									
									
									
										vendored
									
									
								
							@ -1,5 +0,0 @@
 | 
				
			|||||||
REGISTRY_FQDN=localhost:8080
 | 
					 | 
				
			||||||
REGISTRY_SLUG=localhost:8080/test-docker-action
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DISTRIBUTION_HOST=localhost
 | 
					 | 
				
			||||||
DISTRIBUTION_PORT=8080
 | 
					 | 
				
			||||||
							
								
								
									
										13
									
								
								.github/e2e/distribution/install.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.github/e2e/distribution/install.sh
									
									
									
									
										vendored
									
									
								
							@ -1,13 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
set -eu
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: "${DISTRIBUTION_VERSION:=2}"
 | 
					 | 
				
			||||||
: "${DISTRIBUTION_HOST:=localhost}"
 | 
					 | 
				
			||||||
: "${DISTRIBUTION_PORT:=8080}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Starting registry:${DISTRIBUTION_VERSION}"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker run -d --name registry -p "${DISTRIBUTION_PORT}:5000" "registry:${DISTRIBUTION_VERSION}"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
							
								
								
									
										8
									
								
								.github/e2e/harbor/env
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/e2e/harbor/env
									
									
									
									
										vendored
									
									
								
							@ -1,8 +0,0 @@
 | 
				
			|||||||
REGISTRY_FQDN=localhost:8081
 | 
					 | 
				
			||||||
REGISTRY_USER=admin
 | 
					 | 
				
			||||||
REGISTRY_PASSWORD=Harbor12345
 | 
					 | 
				
			||||||
REGISTRY_SLUG=localhost:8081/test-docker-action/test-docker-action
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
HARBOR_HOST=localhost
 | 
					 | 
				
			||||||
HARBOR_PORT=8081
 | 
					 | 
				
			||||||
HARBOR_PROJECT=test-docker-action
 | 
					 | 
				
			||||||
							
								
								
									
										79
									
								
								.github/e2e/harbor/install.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										79
									
								
								.github/e2e/harbor/install.sh
									
									
									
									
										vendored
									
									
								
							@ -1,79 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
set -eu
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: "${HARBOR_VERSION:=v2.7.0}"
 | 
					 | 
				
			||||||
: "${HARBOR_HOST:=localhost}"
 | 
					 | 
				
			||||||
: "${HARBOR_PORT:=49154}"
 | 
					 | 
				
			||||||
: "${REGISTRY_USER:=admin}"
 | 
					 | 
				
			||||||
: "${REGISTRY_PASSWORD:=Harbor12345}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: "${HARBOR_PROJECT:=test-docker-action}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
project_post_data() {
 | 
					 | 
				
			||||||
  cat <<EOF
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  "project_name": "$HARBOR_PROJECT",
 | 
					 | 
				
			||||||
  "public": true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export TERM=xterm
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# download
 | 
					 | 
				
			||||||
echo "::group::Downloading Harbor $HARBOR_VERSION"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  wget -q "https://github.com/goharbor/harbor/releases/download/${HARBOR_VERSION}/harbor-offline-installer-${HARBOR_VERSION}.tgz" -O harbor-online-installer.tgz
 | 
					 | 
				
			||||||
  tar xvf harbor-online-installer.tgz
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# config
 | 
					 | 
				
			||||||
echo "::group::Configuring Harbor"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/harbor
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  cp harbor.yml.tmpl harbor.yml
 | 
					 | 
				
			||||||
  harborConfig="$(harborHost="$HARBOR_HOST" harborPort="$HARBOR_PORT" harborPwd="$REGISTRY_PASSWORD" yq --no-colors '.hostname = env(harborHost) | .http.port = env(harborPort) | .harbor_admin_password = env(harborPwd) | del(.https)' harbor.yml)"
 | 
					 | 
				
			||||||
  tee harbor.yml <<<"$harborConfig" >/dev/null
 | 
					 | 
				
			||||||
  yq --no-colors harbor.yml
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# install and start
 | 
					 | 
				
			||||||
echo "::group::Installing Harbor"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/harbor
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  ./install.sh
 | 
					 | 
				
			||||||
  sleep 10
 | 
					 | 
				
			||||||
  netstat -aptn
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# compose config
 | 
					 | 
				
			||||||
echo "::group::Compose config"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/harbor
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker compose config
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# create project
 | 
					 | 
				
			||||||
echo "::group::Creating project"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$REGISTRY_PASSWORD" -X POST -H "Content-Type: application/json" -d "$(project_post_data)" "http://$HARBOR_HOST:$HARBOR_PORT/api/v2.0/projects"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# list projects
 | 
					 | 
				
			||||||
echo "::group::List projects"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  curl --fail -s -k --max-time 10 -u "$REGISTRY_USER:$REGISTRY_PASSWORD" -H "Content-Type: application/json" "http://$HARBOR_HOST:$HARBOR_PORT/api/v2.0/projects" | jq
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
							
								
								
									
										8
									
								
								.github/e2e/nexus/docker-compose.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/e2e/nexus/docker-compose.yml
									
									
									
									
										vendored
									
									
								
							@ -1,8 +0,0 @@
 | 
				
			|||||||
services:
 | 
					 | 
				
			||||||
  nexus:
 | 
					 | 
				
			||||||
    image: sonatype/nexus3:${NEXUS_VERSION:-latest}
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - "./data:/nexus-data"
 | 
					 | 
				
			||||||
    ports:
 | 
					 | 
				
			||||||
      - "8081:8081"
 | 
					 | 
				
			||||||
      - "8082:8082"
 | 
					 | 
				
			||||||
							
								
								
									
										9
									
								
								.github/e2e/nexus/env
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.github/e2e/nexus/env
									
									
									
									
										vendored
									
									
								
							@ -1,9 +0,0 @@
 | 
				
			|||||||
REGISTRY_FQDN=localhost:8082
 | 
					 | 
				
			||||||
REGISTRY_USER=admin
 | 
					 | 
				
			||||||
REGISTRY_PASSWORD=Nexus12345
 | 
					 | 
				
			||||||
REGISTRY_SLUG=localhost:8082/test-docker-action
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
NEXUS_HOST=localhost
 | 
					 | 
				
			||||||
NEXUS_PORT=8081
 | 
					 | 
				
			||||||
NEXUS_REGISTRY_PORT=8082
 | 
					 | 
				
			||||||
NEXUS_REPO=test-docker-action
 | 
					 | 
				
			||||||
							
								
								
									
										93
									
								
								.github/e2e/nexus/install.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										93
									
								
								.github/e2e/nexus/install.sh
									
									
									
									
										vendored
									
									
								
							@ -1,93 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					 | 
				
			||||||
set -eu
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: "${NEXUS_VERSION:=3.47.1}"
 | 
					 | 
				
			||||||
: "${NEXUS_HOST:=localhost}"
 | 
					 | 
				
			||||||
: "${NEXUS_PORT:=8081}"
 | 
					 | 
				
			||||||
: "${NEXUS_REGISTRY_PORT:=8082}"
 | 
					 | 
				
			||||||
: "${REGISTRY_USER:=admin}"
 | 
					 | 
				
			||||||
: "${REGISTRY_PASSWORD:=Nexus12345}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
: "${NEXUS_REPO:=test-docker-action}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
createrepo_post_data() {
 | 
					 | 
				
			||||||
  cat <<EOF
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  "name": "${NEXUS_REPO}",
 | 
					 | 
				
			||||||
  "online": true,
 | 
					 | 
				
			||||||
  "storage": {
 | 
					 | 
				
			||||||
    "blobStoreName": "default",
 | 
					 | 
				
			||||||
    "strictContentTypeValidation": true,
 | 
					 | 
				
			||||||
    "writePolicy": "ALLOW"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "docker": {
 | 
					 | 
				
			||||||
    "v1Enabled": false,
 | 
					 | 
				
			||||||
    "forceBasicAuth": true,
 | 
					 | 
				
			||||||
    "httpPort": ${NEXUS_REGISTRY_PORT},
 | 
					 | 
				
			||||||
    "httpsPort": null,
 | 
					 | 
				
			||||||
    "subdomain": null
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
EOF
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export NEXUS_VERSION
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
mkdir -p /tmp/nexus/data
 | 
					 | 
				
			||||||
chown 200:200 /tmp/nexus/data
 | 
					 | 
				
			||||||
cp "${SCRIPT_DIR}/docker-compose.yml" /tmp/nexus/docker-compose.yml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Pulling Nexus $NEXUS_VERSION"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/nexus
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker compose pull
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Compose config"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/nexus
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker compose config
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Running Nexus"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/nexus
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker compose up -d
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Running Nexus"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  cd /tmp/nexus
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  docker compose up -d
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Waiting for Nexus to be ready"
 | 
					 | 
				
			||||||
until $(curl --output /dev/null --silent --head --fail "http://$NEXUS_HOST:$NEXUS_PORT"); do
 | 
					 | 
				
			||||||
  printf '.'
 | 
					 | 
				
			||||||
  sleep 5
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Change user's password"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$(cat /tmp/nexus/data/admin.password)" -X PUT -H 'Content-Type: text/plain' -d "$REGISTRY_PASSWORD" "http://$NEXUS_HOST:$NEXUS_PORT/service/rest/v1/security/users/$REGISTRY_USER/change-password"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "::group::Create Docker repository"
 | 
					 | 
				
			||||||
(
 | 
					 | 
				
			||||||
  set -x
 | 
					 | 
				
			||||||
  curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$REGISTRY_PASSWORD" -X POST -H 'Content-Type: application/json' -d "$(createrepo_post_data)" "http://$NEXUS_HOST:$NEXUS_PORT/service/rest/v1/repositories/docker/hosted"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
echo "::endgroup::"
 | 
					 | 
				
			||||||
							
								
								
									
										134
									
								
								.github/workflows/.e2e-run.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										134
									
								
								.github/workflows/.e2e-run.yml
									
									
									
									
										vendored
									
									
								
							@ -1,134 +0,0 @@
 | 
				
			|||||||
# reusable workflow
 | 
					 | 
				
			||||||
name: .e2e-run
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  workflow_call:
 | 
					 | 
				
			||||||
    inputs:
 | 
					 | 
				
			||||||
      id:
 | 
					 | 
				
			||||||
        required: false
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      type:
 | 
					 | 
				
			||||||
        required: true
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      name:
 | 
					 | 
				
			||||||
        required: true
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      registry:
 | 
					 | 
				
			||||||
        required: false
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      slug:
 | 
					 | 
				
			||||||
        required: false
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      username_secret:
 | 
					 | 
				
			||||||
        required: false
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
      password_secret:
 | 
					 | 
				
			||||||
        required: false
 | 
					 | 
				
			||||||
        type: string
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
env:
 | 
					 | 
				
			||||||
  HARBOR_VERSION: v2.7.0
 | 
					 | 
				
			||||||
  NEXUS_VERSION: 3.47.1
 | 
					 | 
				
			||||||
  DISTRIBUTION_VERSION: 2.8.1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  run:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    strategy:
 | 
					 | 
				
			||||||
      fail-fast: false
 | 
					 | 
				
			||||||
      matrix:
 | 
					 | 
				
			||||||
        include:
 | 
					 | 
				
			||||||
          -
 | 
					 | 
				
			||||||
            buildx_version: edge
 | 
					 | 
				
			||||||
            buildkit_image: moby/buildkit:latest
 | 
					 | 
				
			||||||
          -
 | 
					 | 
				
			||||||
            buildx_version: latest
 | 
					 | 
				
			||||||
            buildkit_image: moby/buildkit:buildx-stable-1
 | 
					 | 
				
			||||||
          -
 | 
					 | 
				
			||||||
            buildx_version: https://github.com/docker/buildx.git#master
 | 
					 | 
				
			||||||
            buildkit_image: moby/buildkit:master
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Checkout
 | 
					 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Set up env
 | 
					 | 
				
			||||||
        if: inputs.type == 'local'
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          cat ./.github/e2e/${{ inputs.id }}/env >> $GITHUB_ENV
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Set up BuildKit config
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          touch /tmp/buildkitd.toml
 | 
					 | 
				
			||||||
          if [ "${{ inputs.type }}" = "local" ]; then
 | 
					 | 
				
			||||||
            echo -e "[registry.\"${{ env.REGISTRY_FQDN }}\"]\nhttp = true\ninsecure = true" > /tmp/buildkitd.toml
 | 
					 | 
				
			||||||
          fi
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Set up Docker daemon
 | 
					 | 
				
			||||||
        if: inputs.type == 'local'
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          if [ ! -e /etc/docker/daemon.json ]; then
 | 
					 | 
				
			||||||
            echo '{}' | sudo tee /etc/docker/daemon.json >/dev/null
 | 
					 | 
				
			||||||
          fi
 | 
					 | 
				
			||||||
          DOCKERD_CONFIG=$(jq '.+{"insecure-registries":["http://${{ env.REGISTRY_FQDN }}"]}' /etc/docker/daemon.json)
 | 
					 | 
				
			||||||
          sudo tee /etc/docker/daemon.json <<<"$DOCKERD_CONFIG" >/dev/null
 | 
					 | 
				
			||||||
          cat /etc/docker/daemon.json
 | 
					 | 
				
			||||||
          sudo service docker restart
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Install ${{ inputs.name }}
 | 
					 | 
				
			||||||
        if: inputs.type == 'local'
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          sudo -E bash ./.github/e2e/${{ inputs.id }}/install.sh
 | 
					 | 
				
			||||||
          sudo chown $(id -u):$(id -g) -R ~/.docker
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Docker meta
 | 
					 | 
				
			||||||
        id: meta
 | 
					 | 
				
			||||||
        uses: docker/metadata-action@v5
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          images: ${{ env.REGISTRY_SLUG || inputs.slug }}
 | 
					 | 
				
			||||||
          tags: |
 | 
					 | 
				
			||||||
            type=ref,event=branch,enable=${{ matrix.buildx_version == 'latest' && matrix.buildkit_image == 'moby/buildkit:buildx-stable-1' }}
 | 
					 | 
				
			||||||
            type=ref,event=tag,enable=${{ matrix.buildx_version == 'latest' && matrix.buildkit_image == 'moby/buildkit:buildx-stable-1' }}
 | 
					 | 
				
			||||||
            type=raw,gh-runid-${{ github.run_id }}
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Set up QEMU
 | 
					 | 
				
			||||||
        uses: docker/setup-qemu-action@v3
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Set up Docker Buildx
 | 
					 | 
				
			||||||
        uses: docker/setup-buildx-action@v3
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          version: ${{ matrix.buildx_version }}
 | 
					 | 
				
			||||||
          buildkitd-config: /tmp/buildkitd.toml
 | 
					 | 
				
			||||||
          buildkitd-flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
 | 
					 | 
				
			||||||
          driver-opts: |
 | 
					 | 
				
			||||||
            image=${{ matrix.buildkit_image }}
 | 
					 | 
				
			||||||
            network=host
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Login to Registry
 | 
					 | 
				
			||||||
        if: github.event_name != 'pull_request' && (env.REGISTRY_USER || inputs.username_secret) != ''
 | 
					 | 
				
			||||||
        uses: docker/login-action@v3
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          registry: ${{ env.REGISTRY_FQDN || inputs.registry }}
 | 
					 | 
				
			||||||
          username: ${{ env.REGISTRY_USER || secrets[inputs.username_secret] }}
 | 
					 | 
				
			||||||
          password: ${{ env.REGISTRY_PASSWORD || secrets[inputs.password_secret] }}
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Build and push
 | 
					 | 
				
			||||||
        uses: ./
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          context: ./test
 | 
					 | 
				
			||||||
          file: ./test/multi.Dockerfile
 | 
					 | 
				
			||||||
          platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
 | 
					 | 
				
			||||||
          push: ${{ github.event_name != 'pull_request' }}
 | 
					 | 
				
			||||||
          tags: ${{ steps.meta.outputs.tags }}
 | 
					 | 
				
			||||||
          labels: ${{ steps.meta.outputs.labels }}
 | 
					 | 
				
			||||||
          cache-from: type=registry,ref=${{ env.REGISTRY_SLUG || inputs.slug }}:master
 | 
					 | 
				
			||||||
          cache-to: type=inline
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Inspect image
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          docker pull ${{ env.REGISTRY_SLUG || inputs.slug }}:${{ steps.meta.outputs.version }}
 | 
					 | 
				
			||||||
          docker image inspect ${{ env.REGISTRY_SLUG || inputs.slug }}:${{ steps.meta.outputs.version }}
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Check manifest
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          docker buildx imagetools inspect ${{ env.REGISTRY_SLUG || inputs.slug }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
 | 
					 | 
				
			||||||
							
								
								
									
										1289
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1289
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										104
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										104
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							@ -1,9 +1,5 @@
 | 
				
			|||||||
name: e2e
 | 
					name: e2e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
concurrency:
 | 
					 | 
				
			||||||
  group: ${{ github.workflow }}-${{ github.ref }}
 | 
					 | 
				
			||||||
  cancel-in-progress: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  workflow_dispatch:
 | 
					  workflow_dispatch:
 | 
				
			||||||
  schedule:
 | 
					  schedule:
 | 
				
			||||||
@ -12,103 +8,103 @@ on:
 | 
				
			|||||||
    branches:
 | 
					    branches:
 | 
				
			||||||
      - 'master'
 | 
					      - 'master'
 | 
				
			||||||
    tags:
 | 
					    tags:
 | 
				
			||||||
      - 'v*'
 | 
					      - v*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  build:
 | 
					  docker:
 | 
				
			||||||
    uses: ./.github/workflows/.e2e-run.yml
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      fail-fast: false
 | 
					      fail-fast: false
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        include:
 | 
					        include:
 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: Distribution
 | 
					 | 
				
			||||||
            id: distribution
 | 
					 | 
				
			||||||
            type: local
 | 
					 | 
				
			||||||
          -
 | 
					 | 
				
			||||||
            name: Docker Hub
 | 
					 | 
				
			||||||
            registry: ''
 | 
					            registry: ''
 | 
				
			||||||
            slug: ghactionstest/ghactionstest
 | 
					            slug: ghactionstest/ghactionstest
 | 
				
			||||||
            username_secret: DOCKERHUB_USERNAME
 | 
					            username_secret: DOCKERHUB_USERNAME
 | 
				
			||||||
            password_secret: DOCKERHUB_TOKEN
 | 
					            password_secret: DOCKERHUB_TOKEN
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: GitHub
 | 
					 | 
				
			||||||
            registry: ghcr.io
 | 
					            registry: ghcr.io
 | 
				
			||||||
            slug: ghcr.io/docker-ghactiontest/test
 | 
					            slug: ghcr.io/docker-ghactiontest/test
 | 
				
			||||||
            username_secret: GHCR_USERNAME
 | 
					            username_secret: GHCR_USERNAME
 | 
				
			||||||
            password_secret: GHCR_PAT
 | 
					            password_secret: GHCR_PAT
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: GitLab
 | 
					 | 
				
			||||||
            registry: registry.gitlab.com
 | 
					            registry: registry.gitlab.com
 | 
				
			||||||
            slug: registry.gitlab.com/test1716/test
 | 
					            slug: registry.gitlab.com/test1716/test
 | 
				
			||||||
            username_secret: GITLAB_USERNAME
 | 
					            username_secret: GITLAB_USERNAME
 | 
				
			||||||
            password_secret: GITLAB_TOKEN
 | 
					            password_secret: GITLAB_TOKEN
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: AWS ECR
 | 
					 | 
				
			||||||
            registry: 175142243308.dkr.ecr.us-east-2.amazonaws.com
 | 
					            registry: 175142243308.dkr.ecr.us-east-2.amazonaws.com
 | 
				
			||||||
            slug: 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action
 | 
					            slug: 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action
 | 
				
			||||||
            username_secret: AWS_ACCESS_KEY_ID
 | 
					            username_secret: AWS_ACCESS_KEY_ID
 | 
				
			||||||
            password_secret: AWS_SECRET_ACCESS_KEY
 | 
					            password_secret: AWS_SECRET_ACCESS_KEY
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: AWS ECR Public
 | 
					 | 
				
			||||||
            registry: public.ecr.aws
 | 
					            registry: public.ecr.aws
 | 
				
			||||||
            slug: public.ecr.aws/q3b5f1u4/test-docker-action
 | 
					            slug: public.ecr.aws/q3b5f1u4/test-docker-action
 | 
				
			||||||
            username_secret: AWS_ACCESS_KEY_ID
 | 
					            username_secret: AWS_ACCESS_KEY_ID
 | 
				
			||||||
            password_secret: AWS_SECRET_ACCESS_KEY
 | 
					            password_secret: AWS_SECRET_ACCESS_KEY
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: Google Artifact Registry
 | 
					 | 
				
			||||||
            registry: us-east4-docker.pkg.dev
 | 
					            registry: us-east4-docker.pkg.dev
 | 
				
			||||||
            slug: us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action
 | 
					            slug: us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action
 | 
				
			||||||
            username_secret: GAR_USERNAME
 | 
					            username_secret: GAR_USERNAME
 | 
				
			||||||
            password_secret: GAR_JSON_KEY
 | 
					            password_secret: GAR_JSON_KEY
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: Google Container Registry
 | 
					 | 
				
			||||||
            registry: gcr.io
 | 
					            registry: gcr.io
 | 
				
			||||||
            slug: gcr.io/sandbox-298914/test-docker-action
 | 
					            slug: gcr.io/sandbox-298914/test-docker-action
 | 
				
			||||||
            username_secret: GCR_USERNAME
 | 
					            username_secret: GCR_USERNAME
 | 
				
			||||||
            password_secret: GCR_JSON_KEY
 | 
					            password_secret: GCR_JSON_KEY
 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
          -
 | 
					          -
 | 
				
			||||||
            name: Azure Container Registry
 | 
					 | 
				
			||||||
            registry: officialgithubactions.azurecr.io
 | 
					            registry: officialgithubactions.azurecr.io
 | 
				
			||||||
            slug: officialgithubactions.azurecr.io/test-docker-action
 | 
					            slug: officialgithubactions.azurecr.io/test-docker-action
 | 
				
			||||||
            username_secret: AZURE_CLIENT_ID
 | 
					            username_secret: AZURE_CLIENT_ID
 | 
				
			||||||
            password_secret: AZURE_CLIENT_SECRET
 | 
					            password_secret: AZURE_CLIENT_SECRET
 | 
				
			||||||
            type: remote
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
            name: Quay
 | 
					        name: Checkout
 | 
				
			||||||
            registry: quay.io
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
            slug: quay.io/docker_build_team/ghactiontest
 | 
					 | 
				
			||||||
            username_secret: QUAY_USERNAME
 | 
					 | 
				
			||||||
            password_secret: QUAY_TOKEN
 | 
					 | 
				
			||||||
            type: remote
 | 
					 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
            name: Artifactory
 | 
					        name: Docker meta
 | 
				
			||||||
            registry: infradock.jfrog.io
 | 
					        id: meta
 | 
				
			||||||
            slug: infradock.jfrog.io/test-ghaction/build-push-action
 | 
					        uses: docker/metadata-action@v3
 | 
				
			||||||
            username_secret: ARTIFACTORY_USERNAME
 | 
					        with:
 | 
				
			||||||
            password_secret: ARTIFACTORY_TOKEN
 | 
					          images: ${{ matrix.slug }}
 | 
				
			||||||
            type: remote
 | 
					      -
 | 
				
			||||||
          -
 | 
					        name: Set up QEMU
 | 
				
			||||||
            name: Harbor
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
            id: harbor
 | 
					      -
 | 
				
			||||||
            type: local
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
          -
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
            name: Nexus
 | 
					      -
 | 
				
			||||||
            id: nexus
 | 
					        name: Login to Registry
 | 
				
			||||||
            type: local
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
      id: ${{ matrix.id }}
 | 
					 | 
				
			||||||
      type: ${{ matrix.type }}
 | 
					 | 
				
			||||||
      name: ${{ matrix.name }}
 | 
					 | 
				
			||||||
          registry: ${{ matrix.registry }}
 | 
					          registry: ${{ matrix.registry }}
 | 
				
			||||||
      slug: ${{ matrix.slug }}
 | 
					          username: ${{ secrets[matrix.username_secret] }}
 | 
				
			||||||
      username_secret: ${{ matrix.username_secret }}
 | 
					          password: ${{ secrets[matrix.password_secret] }}
 | 
				
			||||||
      password_secret: ${{ matrix.password_secret }}
 | 
					      -
 | 
				
			||||||
    secrets: inherit
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: ./
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: ./test
 | 
				
			||||||
 | 
					          file: ./test/multi.Dockerfile
 | 
				
			||||||
 | 
					          platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
 | 
				
			||||||
 | 
					          push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					          tags: ${{ steps.meta.outputs.tags }}
 | 
				
			||||||
 | 
					          labels: ${{ steps.meta.outputs.labels }}
 | 
				
			||||||
 | 
					          cache-from: type=registry,ref=${{ matrix.slug }}:master
 | 
				
			||||||
 | 
					          cache-to: type=inline
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Inspect image
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker pull ${{ matrix.slug }}:${{ steps.meta.outputs.version }}
 | 
				
			||||||
 | 
					          docker image inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Check manifest
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker buildx imagetools inspect ${{ matrix.slug }}:${{ steps.meta.outputs.version }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Dump context
 | 
				
			||||||
 | 
					        if: always()
 | 
				
			||||||
 | 
					        uses: crazy-max/ghaction-dump-context@v1
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										78
									
								
								.github/workflows/example.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/example.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,78 @@
 | 
				
			|||||||
 | 
					# This workflow is provided just as an example and not for repo testing/verification
 | 
				
			||||||
 | 
					name: example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  schedule:
 | 
				
			||||||
 | 
					    - cron: '0 10 * * 0'
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - '**'
 | 
				
			||||||
 | 
					    tags:
 | 
				
			||||||
 | 
					      - 'v*.*.*'
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  DOCKER_IMAGE: localhost:5000/name/app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    services:
 | 
				
			||||||
 | 
					      registry:
 | 
				
			||||||
 | 
					        image: registry:2
 | 
				
			||||||
 | 
					        ports:
 | 
				
			||||||
 | 
					          - 5000:5000
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker meta
 | 
				
			||||||
 | 
					        id: meta
 | 
				
			||||||
 | 
					        uses: docker/metadata-action@v3
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          images: ${{ env.DOCKER_IMAGE }}
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            type=schedule
 | 
				
			||||||
 | 
					            type=ref,event=branch
 | 
				
			||||||
 | 
					            type=ref,event=pr
 | 
				
			||||||
 | 
					            type=semver,pattern={{version}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}.{{minor}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}
 | 
				
			||||||
 | 
					            type=sha
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          driver-opts: network=host
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and export to Docker client
 | 
				
			||||||
 | 
					        uses: ./
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: ./test
 | 
				
			||||||
 | 
					          file: ./test/Dockerfile
 | 
				
			||||||
 | 
					          load: true
 | 
				
			||||||
 | 
					          tags: ${{ steps.meta.outputs.tags }}
 | 
				
			||||||
 | 
					          labels: ${{ steps.meta.outputs.labels }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push to local registry
 | 
				
			||||||
 | 
					        uses: ./
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: ./test
 | 
				
			||||||
 | 
					          file: ./test/Dockerfile
 | 
				
			||||||
 | 
					          push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					          tags: ${{ steps.meta.outputs.tags }}
 | 
				
			||||||
 | 
					          labels: ${{ steps.meta.outputs.labels }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Inspect image
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Check manifest
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Dump context
 | 
				
			||||||
 | 
					        if: always()
 | 
				
			||||||
 | 
					        uses: crazy-max/ghaction-dump-context@v1
 | 
				
			||||||
							
								
								
									
										17
									
								
								.github/workflows/pr-assign-author.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/pr-assign-author.yml
									
									
									
									
										vendored
									
									
								
							@ -1,17 +0,0 @@
 | 
				
			|||||||
name: pr-assign-author
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
permissions:
 | 
					 | 
				
			||||||
  contents: read
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  pull_request_target:
 | 
					 | 
				
			||||||
    types:
 | 
					 | 
				
			||||||
      - opened
 | 
					 | 
				
			||||||
      - reopened
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  run:
 | 
					 | 
				
			||||||
    uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
 | 
					 | 
				
			||||||
    permissions:
 | 
					 | 
				
			||||||
      contents: read
 | 
					 | 
				
			||||||
      pull-requests: write
 | 
					 | 
				
			||||||
							
								
								
									
										21
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
								
							@ -1,21 +0,0 @@
 | 
				
			|||||||
name: publish
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  release:
 | 
					 | 
				
			||||||
    types:
 | 
					 | 
				
			||||||
      - published
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  publish:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    permissions:
 | 
					 | 
				
			||||||
      contents: read
 | 
					 | 
				
			||||||
      id-token: write
 | 
					 | 
				
			||||||
      packages: write
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Checkout
 | 
					 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Publish
 | 
					 | 
				
			||||||
        uses: actions/publish-immutable-action@v0.0.4
 | 
					 | 
				
			||||||
							
								
								
									
										22
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@ -1,15 +1,12 @@
 | 
				
			|||||||
name: test
 | 
					name: test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
concurrency:
 | 
					 | 
				
			||||||
  group: ${{ github.workflow }}-${{ github.ref }}
 | 
					 | 
				
			||||||
  cancel-in-progress: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches:
 | 
					    branches:
 | 
				
			||||||
      - 'master'
 | 
					      - 'master'
 | 
				
			||||||
      - 'releases/v*'
 | 
					 | 
				
			||||||
  pull_request:
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'master'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  test:
 | 
					  test:
 | 
				
			||||||
@ -17,16 +14,19 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Checkout
 | 
					        name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					        uses: actions/checkout@v3
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Validate
 | 
				
			||||||
 | 
					        uses: docker/bake-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          targets: validate
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Test
 | 
					        name: Test
 | 
				
			||||||
        uses: docker/bake-action@v6
 | 
					        uses: docker/bake-action@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source: .
 | 
					 | 
				
			||||||
          targets: test
 | 
					          targets: test
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Upload coverage
 | 
					        name: Upload coverage
 | 
				
			||||||
        uses: codecov/codecov-action@v5
 | 
					        uses: codecov/codecov-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          files: ./coverage/clover.xml
 | 
					          file: ./coverage/clover.xml
 | 
				
			||||||
          token: ${{ secrets.CODECOV_TOKEN }}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										43
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										43
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
								
							@ -1,43 +0,0 @@
 | 
				
			|||||||
name: validate
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
concurrency:
 | 
					 | 
				
			||||||
  group: ${{ github.workflow }}-${{ github.ref }}
 | 
					 | 
				
			||||||
  cancel-in-progress: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  push:
 | 
					 | 
				
			||||||
    branches:
 | 
					 | 
				
			||||||
      - 'master'
 | 
					 | 
				
			||||||
      - 'releases/v*'
 | 
					 | 
				
			||||||
  pull_request:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  prepare:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    outputs:
 | 
					 | 
				
			||||||
      targets: ${{ steps.generate.outputs.targets }}
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Checkout
 | 
					 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: List targets
 | 
					 | 
				
			||||||
        id: generate
 | 
					 | 
				
			||||||
        uses: docker/bake-action/subaction/list-targets@v6
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          target: validate
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  validate:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    needs:
 | 
					 | 
				
			||||||
      - prepare
 | 
					 | 
				
			||||||
    strategy:
 | 
					 | 
				
			||||||
      fail-fast: false
 | 
					 | 
				
			||||||
      matrix:
 | 
					 | 
				
			||||||
        target: ${{ fromJson(needs.prepare.outputs.targets) }}
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Validate
 | 
					 | 
				
			||||||
        uses: docker/bake-action@v6
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          targets: ${{ matrix.target }}
 | 
					 | 
				
			||||||
							
								
								
									
										43
									
								
								.github/workflows/virtual-env.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								.github/workflows/virtual-env.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					name: virtual-env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  workflow_dispatch:
 | 
				
			||||||
 | 
					  schedule:
 | 
				
			||||||
 | 
					    - cron: '0 10 * * *'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  os:
 | 
				
			||||||
 | 
					    runs-on: ${{ matrix.os }}
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      fail-fast: false
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        os:
 | 
				
			||||||
 | 
					          - ubuntu-latest
 | 
				
			||||||
 | 
					          - ubuntu-20.04
 | 
				
			||||||
 | 
					          - ubuntu-18.04
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: File system
 | 
				
			||||||
 | 
					        run: df -ah
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: List install packages
 | 
				
			||||||
 | 
					        run: apt list --installed
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker info
 | 
				
			||||||
 | 
					        run: docker info
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker version
 | 
				
			||||||
 | 
					        run: docker version
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: buildx version
 | 
				
			||||||
 | 
					        run: docker buildx version
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: containerd version
 | 
				
			||||||
 | 
					        run: containerd --version
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker images
 | 
				
			||||||
 | 
					        run: docker image ls
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Dump context
 | 
				
			||||||
 | 
					        if: always()
 | 
				
			||||||
 | 
					        uses: crazy-max/ghaction-dump-context@v1
 | 
				
			||||||
							
								
								
									
										70
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,5 +1,11 @@
 | 
				
			|||||||
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
 | 
					node_modules
 | 
				
			||||||
 | 
					lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Jetbrains
 | 
				
			||||||
 | 
					/.idea
 | 
				
			||||||
 | 
					/*.iml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
 | 
				
			||||||
# Logs
 | 
					# Logs
 | 
				
			||||||
logs
 | 
					logs
 | 
				
			||||||
*.log
 | 
					*.log
 | 
				
			||||||
@ -7,7 +13,6 @@ npm-debug.log*
 | 
				
			|||||||
yarn-debug.log*
 | 
					yarn-debug.log*
 | 
				
			||||||
yarn-error.log*
 | 
					yarn-error.log*
 | 
				
			||||||
lerna-debug.log*
 | 
					lerna-debug.log*
 | 
				
			||||||
.pnpm-debug.log*
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
 | 
					# Diagnostic reports (https://nodejs.org/api/report.html)
 | 
				
			||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
 | 
					report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
 | 
				
			||||||
@ -18,14 +23,34 @@ pids
 | 
				
			|||||||
*.seed
 | 
					*.seed
 | 
				
			||||||
*.pid.lock
 | 
					*.pid.lock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Directory for instrumented libs generated by jscoverage/JSCover
 | 
				
			||||||
 | 
					lib-cov
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Coverage directory used by tools like istanbul
 | 
					# Coverage directory used by tools like istanbul
 | 
				
			||||||
coverage
 | 
					coverage
 | 
				
			||||||
*.lcov
 | 
					*.lcov
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# nyc test coverage
 | 
				
			||||||
 | 
					.nyc_output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
 | 
				
			||||||
 | 
					.grunt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Bower dependency directory (https://bower.io/)
 | 
				
			||||||
 | 
					bower_components
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# node-waf configuration
 | 
				
			||||||
 | 
					.lock-wscript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Compiled binary addons (https://nodejs.org/api/addons.html)
 | 
				
			||||||
 | 
					build/Release
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Dependency directories
 | 
					# Dependency directories
 | 
				
			||||||
node_modules/
 | 
					 | 
				
			||||||
jspm_packages/
 | 
					jspm_packages/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TypeScript v1 declaration files
 | 
				
			||||||
 | 
					typings/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TypeScript cache
 | 
					# TypeScript cache
 | 
				
			||||||
*.tsbuildinfo
 | 
					*.tsbuildinfo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,19 +60,36 @@ jspm_packages/
 | 
				
			|||||||
# Optional eslint cache
 | 
					# Optional eslint cache
 | 
				
			||||||
.eslintcache
 | 
					.eslintcache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Optional REPL history
 | 
				
			||||||
 | 
					.node_repl_history
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Output of 'npm pack'
 | 
				
			||||||
 | 
					*.tgz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Yarn Integrity file
 | 
					# Yarn Integrity file
 | 
				
			||||||
.yarn-integrity
 | 
					.yarn-integrity
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# dotenv environment variable files
 | 
					# dotenv environment variables file
 | 
				
			||||||
.env
 | 
					.env
 | 
				
			||||||
.env.development.local
 | 
					.env.test
 | 
				
			||||||
.env.test.local
 | 
					 | 
				
			||||||
.env.production.local
 | 
					 | 
				
			||||||
.env.local
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# yarn v2
 | 
					# parcel-bundler cache (https://parceljs.org/)
 | 
				
			||||||
.yarn/cache
 | 
					.cache
 | 
				
			||||||
.yarn/unplugged
 | 
					
 | 
				
			||||||
.yarn/build-state.yml
 | 
					# next.js build output
 | 
				
			||||||
.yarn/install-state.gz
 | 
					.next
 | 
				
			||||||
.pnp.*
 | 
					
 | 
				
			||||||
 | 
					# nuxt.js build output
 | 
				
			||||||
 | 
					.nuxt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# vuepress build output
 | 
				
			||||||
 | 
					.vuepress/dist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Serverless directories
 | 
				
			||||||
 | 
					.serverless/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# FuseBox cache
 | 
				
			||||||
 | 
					.fusebox/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# DynamoDB Local files
 | 
				
			||||||
 | 
					.dynamodb/
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +0,0 @@
 | 
				
			|||||||
# Dependency directories
 | 
					 | 
				
			||||||
node_modules/
 | 
					 | 
				
			||||||
jspm_packages/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# yarn v2
 | 
					 | 
				
			||||||
.yarn/
 | 
					 | 
				
			||||||
							
								
								
									
										541
									
								
								.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										541
									
								
								.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										13
									
								
								.yarnrc.yml
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								.yarnrc.yml
									
									
									
									
									
								
							@ -1,13 +0,0 @@
 | 
				
			|||||||
logFilters:
 | 
					 | 
				
			||||||
  - code: YN0013
 | 
					 | 
				
			||||||
    level: discard
 | 
					 | 
				
			||||||
  - code: YN0019
 | 
					 | 
				
			||||||
    level: discard
 | 
					 | 
				
			||||||
  - code: YN0076
 | 
					 | 
				
			||||||
    level: discard
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
nodeLinker: node-modules
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
plugins:
 | 
					 | 
				
			||||||
  - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
 | 
					 | 
				
			||||||
    spec: "@yarnpkg/plugin-interactive-tools"
 | 
					 | 
				
			||||||
							
								
								
									
										237
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										237
									
								
								README.md
									
									
									
									
									
								
							@ -1,15 +1,14 @@
 | 
				
			|||||||
[](https://github.com/docker/build-push-action/releases/latest)
 | 
					[](https://github.com/docker/build-push-action/releases/latest)
 | 
				
			||||||
[](https://github.com/marketplace/actions/build-and-push-docker-images)
 | 
					[](https://github.com/marketplace/actions/build-and-push-docker-images)
 | 
				
			||||||
[](https://github.com/docker/build-push-action/actions?workflow=ci)
 | 
					[](https://github.com/docker/build-push-action/actions?workflow=ci)
 | 
				
			||||||
[](https://github.com/docker/build-push-action/actions?workflow=test)
 | 
					[](https://github.com/docker/build-push-action/actions?workflow=test)
 | 
				
			||||||
[](https://codecov.io/gh/docker/build-push-action)
 | 
					[](https://codecov.io/gh/docker/build-push-action)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## About
 | 
					## About
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GitHub Action to build and push Docker images with [Buildx](https://github.com/docker/buildx)
 | 
					GitHub Action to build and push Docker images with [Buildx](https://github.com/docker/buildx) with full support of the
 | 
				
			||||||
with full support of the features provided by [Moby BuildKit](https://github.com/moby/buildkit)
 | 
					features provided by [Moby BuildKit](https://github.com/moby/buildkit) builder toolkit. This includes multi-platform
 | 
				
			||||||
builder toolkit. This includes multi-platform build, secrets, remote cache, etc.
 | 
					build, secrets, remote cache, etc. and different builder deployment/namespacing options.
 | 
				
			||||||
and different builder deployment/namespacing options.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -18,36 +17,43 @@ ___
 | 
				
			|||||||
* [Usage](#usage)
 | 
					* [Usage](#usage)
 | 
				
			||||||
  * [Git context](#git-context)
 | 
					  * [Git context](#git-context)
 | 
				
			||||||
  * [Path context](#path-context)
 | 
					  * [Path context](#path-context)
 | 
				
			||||||
* [Examples](#examples)
 | 
					* [Advanced usage](#advanced-usage)
 | 
				
			||||||
* [Summaries](#summaries)
 | 
					  * [Multi-platform image](docs/advanced/multi-platform.md)
 | 
				
			||||||
 | 
					  * [Secrets](docs/advanced/secrets.md)
 | 
				
			||||||
 | 
					  * [Isolated builders](docs/advanced/isolated-builders.md)
 | 
				
			||||||
 | 
					  * [Push to multi-registries](docs/advanced/push-multi-registries.md)
 | 
				
			||||||
 | 
					  * [Copy between registries](docs/advanced/copy-between-registries.md)  
 | 
				
			||||||
 | 
					  * [Cache](docs/advanced/cache.md)
 | 
				
			||||||
 | 
					  * [Local registry](docs/advanced/local-registry.md)
 | 
				
			||||||
 | 
					  * [Export image to Docker](docs/advanced/export-docker.md)
 | 
				
			||||||
 | 
					  * [Share built image between jobs](docs/advanced/share-image-jobs.md)
 | 
				
			||||||
 | 
					  * [Test your image before pushing it](docs/advanced/test-before-push.md)
 | 
				
			||||||
 | 
					  * [Handle tags and labels](docs/advanced/tags-labels.md)
 | 
				
			||||||
 | 
					  * [Update DockerHub repo description](docs/advanced/dockerhub-desc.md)
 | 
				
			||||||
* [Customizing](#customizing)
 | 
					* [Customizing](#customizing)
 | 
				
			||||||
  * [inputs](#inputs)
 | 
					  * [inputs](#inputs)
 | 
				
			||||||
  * [outputs](#outputs)
 | 
					  * [outputs](#outputs)
 | 
				
			||||||
  * [environment variables](#environment-variables)
 | 
					 | 
				
			||||||
* [Troubleshooting](#troubleshooting)
 | 
					* [Troubleshooting](#troubleshooting)
 | 
				
			||||||
* [Contributing](#contributing)
 | 
					* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
In the examples below we are also using 3 other actions:
 | 
					In the examples below we are also using 3 other actions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* [`setup-buildx`](https://github.com/docker/setup-buildx-action) action will
 | 
					* [`setup-buildx`](https://github.com/docker/setup-buildx-action) action will create and boot a builder using by 
 | 
				
			||||||
  create and boot a builder using by default the [`docker-container` driver](https://docs.docker.com/build/building/drivers/docker-container/).
 | 
					default the `docker-container` [builder driver](https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#driver).
 | 
				
			||||||
  This is **not required but recommended** using it to be able to build
 | 
					This is **not required but recommended** using it to be able to build multi-platform images, export cache, etc.
 | 
				
			||||||
  multi-platform images, export cache, etc.
 | 
					* [`setup-qemu`](https://github.com/docker/setup-qemu-action) action can be useful if you want
 | 
				
			||||||
* [`setup-qemu`](https://github.com/docker/setup-qemu-action) action can be
 | 
					to add emulation support with QEMU to be able to build against more platforms. 
 | 
				
			||||||
  useful if you want to add emulation support with QEMU to be able to build
 | 
					* [`login`](https://github.com/docker/login-action) action will take care to log in against a Docker registry.
 | 
				
			||||||
  against more platforms. 
 | 
					 | 
				
			||||||
* [`login`](https://github.com/docker/login-action) action will take care to
 | 
					 | 
				
			||||||
  log in against a Docker registry.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Git context
 | 
					### Git context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
By default, this action uses the [Git context](https://docs.docker.com/engine/reference/commandline/build/#git-repositories),
 | 
					By default, this action uses the [Git context](#git-context) so you don't need
 | 
				
			||||||
so you don't need to use the [`actions/checkout`](https://github.com/actions/checkout/)
 | 
					to use the [`actions/checkout`](https://github.com/actions/checkout/) action to
 | 
				
			||||||
action to check out the repository as this will be done directly by [BuildKit](https://github.com/moby/buildkit).
 | 
					check out the repository because this will be done directly by [BuildKit](https://github.com/moby/buildkit).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The git reference will be based on the [event that triggered your workflow](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)
 | 
					The git reference will be based on the [event that triggered your workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows)
 | 
				
			||||||
and will result in the following context: `https://github.com/<owner>/<repo>.git#<ref>`.
 | 
					and will result in the following context: `https://github.com/<owner>/<repo>.git#<ref>`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
@ -55,26 +61,28 @@ name: ci
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  docker:
 | 
					  docker:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Login to Docker Hub
 | 
					 | 
				
			||||||
        uses: docker/login-action@v3
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          username: ${{ vars.DOCKERHUB_USERNAME }}
 | 
					 | 
				
			||||||
          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
					 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up QEMU
 | 
					        name: Set up QEMU
 | 
				
			||||||
        uses: docker/setup-qemu-action@v3
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up Docker Buildx
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
        uses: docker/setup-buildx-action@v3
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        uses: docker/build-push-action@v6
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
          tags: user/app:latest
 | 
					          tags: user/app:latest
 | 
				
			||||||
@ -94,22 +102,23 @@ to the default Git context:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        uses: docker/build-push-action@v6
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: "{{defaultContext}}:mysubdir"
 | 
					          context: "{{defaultContext}}:mysubdir"
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
          tags: user/app:latest
 | 
					          tags: user/app:latest
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					> :warning: Subdirectory for Git context is not yet available for the buildx [`docker` driver](https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#driver).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Building from the current repository automatically uses the [GitHub Token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication),
 | 
					Building from the current repository automatically uses the [GitHub Token](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)
 | 
				
			||||||
so it does not need to be passed. If you want to authenticate against another
 | 
					so it does not need to be passed. If you want to authenticate against another
 | 
				
			||||||
private repository, you have to use a [secret](https://docs.docker.com/build/ci/github-actions/secrets)
 | 
					private repository, you have to use a [secret](docs/advanced/secrets.md) named
 | 
				
			||||||
named `GIT_AUTH_TOKEN` to be able to authenticate against it with Buildx:
 | 
					`GIT_AUTH_TOKEN` to be able to authenticate against it with buildx:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        uses: docker/build-push-action@v6
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
          tags: user/app:latest
 | 
					          tags: user/app:latest
 | 
				
			||||||
@ -124,6 +133,8 @@ name: ci
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  docker:
 | 
					  docker:
 | 
				
			||||||
@ -131,85 +142,48 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Checkout
 | 
					        name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
      -
 | 
					 | 
				
			||||||
        name: Login to Docker Hub
 | 
					 | 
				
			||||||
        uses: docker/login-action@v3
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          username: ${{ vars.DOCKERHUB_USERNAME }}
 | 
					 | 
				
			||||||
          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
					 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up QEMU
 | 
					        name: Set up QEMU
 | 
				
			||||||
        uses: docker/setup-qemu-action@v3
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up Docker Buildx
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
        uses: docker/setup-buildx-action@v3
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        uses: docker/build-push-action@v6
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
          tags: user/app:latest
 | 
					          tags: user/app:latest
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Examples
 | 
					## Advanced usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/)
 | 
					* [Multi-platform image](docs/advanced/multi-platform.md)
 | 
				
			||||||
* [Secrets](https://docs.docker.com/build/ci/github-actions/secrets/)
 | 
					* [Secrets](docs/advanced/secrets.md)
 | 
				
			||||||
* [Push to multi-registries](https://docs.docker.com/build/ci/github-actions/push-multi-registries/)
 | 
					* [Isolated builders](docs/advanced/isolated-builders.md)
 | 
				
			||||||
* [Manage tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/)
 | 
					* [Push to multi-registries](docs/advanced/push-multi-registries.md)
 | 
				
			||||||
* [Cache management](https://docs.docker.com/build/ci/github-actions/cache/)
 | 
					* [Copy between registries](docs/advanced/copy-between-registries.md)
 | 
				
			||||||
* [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/)
 | 
					* [Cache](docs/advanced/cache.md)
 | 
				
			||||||
* [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/)
 | 
					* [Local registry](docs/advanced/local-registry.md)
 | 
				
			||||||
* [Validating build configuration](https://docs.docker.com/build/ci/github-actions/checks/)
 | 
					* [Export image to Docker](docs/advanced/export-docker.md)
 | 
				
			||||||
* [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/)
 | 
					* [Share built image between jobs](docs/advanced/share-image-jobs.md)
 | 
				
			||||||
* [Share built image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/)
 | 
					* [Test your image before pushing it](docs/advanced/test-before-push.md)
 | 
				
			||||||
* [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/)
 | 
					* [Handle tags and labels](docs/advanced/tags-labels.md)
 | 
				
			||||||
* [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/)
 | 
					* [Update DockerHub repo description](docs/advanced/dockerhub-desc.md)
 | 
				
			||||||
* [Update Docker Hub repo description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/)
 | 
					 | 
				
			||||||
* [SBOM and provenance attestations](https://docs.docker.com/build/ci/github-actions/attestations/)
 | 
					 | 
				
			||||||
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
 | 
					 | 
				
			||||||
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Summaries
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
 | 
					 | 
				
			||||||
that provides a detailed overview of the build execution. The summary shows an
 | 
					 | 
				
			||||||
overview of all the steps executed during the build, including the build inputs
 | 
					 | 
				
			||||||
and eventual errors.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||

 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The summary also includes a link for downloading the build record with
 | 
					 | 
				
			||||||
additional details about the build, including build stats, logs, outputs, and
 | 
					 | 
				
			||||||
more. The build record can be imported to Docker Desktop for inspecting the
 | 
					 | 
				
			||||||
build in greater detail.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> [!WARNING]
 | 
					 | 
				
			||||||
>
 | 
					 | 
				
			||||||
> If you're using the [`actions/download-artifact`](https://github.com/actions/download-artifact)
 | 
					 | 
				
			||||||
> action in your workflow, you need to ignore the build record artifacts
 | 
					 | 
				
			||||||
> if `name` and `pattern` inputs are not specified ([defaults to download all artifacts](https://github.com/actions/download-artifact?tab=readme-ov-file#download-all-artifacts) of the workflow),
 | 
					 | 
				
			||||||
> otherwise the action will fail:
 | 
					 | 
				
			||||||
> ```yaml
 | 
					 | 
				
			||||||
> - uses: actions/download-artifact@v4
 | 
					 | 
				
			||||||
>   with:
 | 
					 | 
				
			||||||
>     pattern: "!*.dockerbuild"
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> More info: https://github.com/actions/toolkit/pull/1874
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Summaries are enabled by default, but can be disabled with the
 | 
					 | 
				
			||||||
`DOCKER_BUILD_SUMMARY` [environment variable](#environment-variables).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
For more information about summaries, refer to the
 | 
					 | 
				
			||||||
[documentation](https://docs.docker.com/go/build-summary/).
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Customizing
 | 
					## Customizing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### inputs
 | 
					### inputs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following inputs can be used as `step.with` keys:
 | 
					Following inputs can be used as `step.with` keys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> `List` type is a newline-delimited string
 | 
					> `List` type is a newline-delimited string
 | 
				
			||||||
> ```yaml
 | 
					> ```yaml
 | 
				
			||||||
@ -224,65 +198,60 @@ The following inputs can be used as `step.with` keys:
 | 
				
			|||||||
> ```
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Name                | Type     | Description                        |
 | 
					| Name                | Type     | Description                        |
 | 
				
			||||||
|--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | 
					|---------------------|----------|------------------------------------|
 | 
				
			||||||
| `add-hosts`         | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
 | 
					| `add-hosts`         | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
 | 
				
			||||||
| `allow`            | List/CSV    | List of [extra privileged entitlement](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow) (e.g., `network.host,security.insecure`)                         |
 | 
					| `allow`             | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (e.g., `network.host,security.insecure`) |
 | 
				
			||||||
| `annotations`      | List        | List of annotation to set to the image                                                                                                                                            |
 | 
					 | 
				
			||||||
| `attests`          | List        | List of [attestation](https://docs.docker.com/build/attestations/) parameters (e.g., `type=sbom,generator=image`)                                                                 | 
 | 
					 | 
				
			||||||
| `builder`           | String   | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
 | 
					| `builder`           | String   | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
 | 
				
			||||||
| `build-args`       | List        | List of [build-time variables](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-arg)                                                                      |
 | 
					| `build-args`        | List     | List of [build-time variables](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-arg) |
 | 
				
			||||||
| `build-contexts`   | List        | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`)                                         |
 | 
					| `build-contexts`    | List     | List of additional [build contexts](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-context) (e.g., `name=path`) |
 | 
				
			||||||
| `cache-from`       | List        | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`)                              |
 | 
					| `cache-from`        | List     | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (e.g., `type=local,src=path/to/dir`) |
 | 
				
			||||||
| `cache-to`         | List        | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`)                            |
 | 
					| `cache-to`          | List     | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (e.g., `type=local,dest=path/to/dir`) |
 | 
				
			||||||
| `call`             | String      | Set [method for evaluating build](https://docs.docker.com/reference/cli/docker/buildx/build/#call) (e.g., `check`)                                                                |
 | 
					 | 
				
			||||||
| `cgroup-parent`     | String   | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
 | 
					| `cgroup-parent`     | String   | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
 | 
				
			||||||
| `context`           | String   | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
 | 
					| `context`           | String   | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
 | 
				
			||||||
| `file`              | String   | Path to the Dockerfile. (default `{context}/Dockerfile`) |
 | 
					| `file`              | String   | Path to the Dockerfile. (default `{context}/Dockerfile`) |
 | 
				
			||||||
| `labels`            | List     | List of metadata for an image |
 | 
					| `labels`            | List     | List of metadata for an image |
 | 
				
			||||||
| `load`             | Bool        | [Load](https://docs.docker.com/engine/reference/commandline/buildx_build/#load) is a shorthand for `--output=type=docker` (default `false`)                                       |
 | 
					| `load`              | Bool     | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) |
 | 
				
			||||||
| `network`           | String   | Set the networking mode for the `RUN` instructions during build |
 | 
					| `network`           | String   | Set the networking mode for the `RUN` instructions during build |
 | 
				
			||||||
| `no-cache`          | Bool     | Do not use cache when building the image (default `false`) |
 | 
					| `no-cache`          | Bool     | Do not use cache when building the image (default `false`) |
 | 
				
			||||||
| `no-cache-filters` | List/CSV    | Do not cache specified stages                                                                                                                                                     |
 | 
					| `outputs`           | List     | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) |
 | 
				
			||||||
| `outputs`          | List        | List of [output destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) (format: `type=local,dest=path`)                                         |
 | 
					| `platforms`         | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
 | 
				
			||||||
| `platforms`        | List/CSV    | List of [target platforms](https://docs.docker.com/engine/reference/commandline/buildx_build/#platform) for build                                                                 |
 | 
					 | 
				
			||||||
| `provenance`       | Bool/String | Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`)                           |
 | 
					 | 
				
			||||||
| `pull`              | Bool     | Always attempt to pull all referenced images (default `false`) |
 | 
					| `pull`              | Bool     | Always attempt to pull all referenced images (default `false`) |
 | 
				
			||||||
| `push`             | Bool        | [Push](https://docs.docker.com/engine/reference/commandline/buildx_build/#push) is a shorthand for `--output=type=registry` (default `false`)                                     |
 | 
					| `push`              | Bool     | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) |
 | 
				
			||||||
| `sbom`             | Bool/String | Generate [SBOM](https://docs.docker.com/build/attestations/sbom/) attestation for the build (shorthand for `--attest=type=sbom`)                                                  |
 | 
					| `secrets`           | List     | List of [secrets](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
 | 
				
			||||||
| `secrets`          | List        | List of [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`)                |
 | 
					| `secret-files`      | List     | List of [secret files](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
 | 
				
			||||||
| `secret-envs`      | List/CSV    | List of [secret env vars](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=envname`, `MY_SECRET=MY_ENV_VAR`)         |
 | 
					| `shm-size`          | String   | Size of [`/dev/shm`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-size-of-devshm---shm-size) (e.g., `2g`) |
 | 
				
			||||||
| `secret-files`     | List        | List of [secret files](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`)         |
 | 
					| `ssh`               | List     | List of [SSH agent socket or keys](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#ssh) to expose to the build |
 | 
				
			||||||
| `shm-size`         | String      | Size of [`/dev/shm`](https://docs.docker.com/engine/reference/commandline/buildx_build/#shm-size) (e.g., `2g`)                                                                    |
 | 
					 | 
				
			||||||
| `ssh`              | List        | List of [SSH agent socket or keys](https://docs.docker.com/engine/reference/commandline/buildx_build/#ssh) to expose to the build                                                 |
 | 
					 | 
				
			||||||
| `tags`              | List/CSV | List of tags |
 | 
					| `tags`              | List/CSV | List of tags |
 | 
				
			||||||
| `target`            | String   | Sets the target stage to build |
 | 
					| `target`            | String   | Sets the target stage to build |
 | 
				
			||||||
| `ulimit`           | List        | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`)                                                            |
 | 
					| `ulimit`            | List     | [Ulimit](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-ulimits---ulimit) options (e.g., `nofile=1024:1024`) |
 | 
				
			||||||
| `github-token`      | String   | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
 | 
					| `github-token`      | String   | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### outputs
 | 
					### outputs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following outputs are available:
 | 
					Following outputs are available
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Name              | Type    | Description                           |
 | 
					| Name              | Type    | Description                           |
 | 
				
			||||||
|------------|---------|-----------------------|
 | 
					|-------------------|---------|---------------------------------------|
 | 
				
			||||||
| `imageid`         | String  | Image ID |
 | 
					| `imageid`         | String  | Image ID |
 | 
				
			||||||
| `digest`          | String  | Image digest |
 | 
					| `digest`          | String  | Image digest |
 | 
				
			||||||
| `metadata`        | JSON    | Build result metadata |
 | 
					| `metadata`        | JSON    | Build result metadata |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### environment variables
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| Name                                 | Type   | Default | Description                                                                                                                                                                                                                                                        |
 | 
					 | 
				
			||||||
|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | 
					 | 
				
			||||||
| `DOCKER_BUILD_CHECKS_ANNOTATIONS`    | Bool   | `true`  | If `false`, GitHub annotations are not generated for [build checks](https://docs.docker.com/build/checks/)                                                                                                                                                         |
 | 
					 | 
				
			||||||
| `DOCKER_BUILD_SUMMARY`               | Bool   | `true`  | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled                                                                                                                                                 |
 | 
					 | 
				
			||||||
| `DOCKER_BUILD_RECORD_UPLOAD`         | Bool   | `true`  | If `false`, build record upload as [GitHub artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) is disabled                                                                                                            |
 | 
					 | 
				
			||||||
| `DOCKER_BUILD_RECORD_RETENTION_DAYS` | Number |         | Duration after which build record artifact will expire in days. Defaults to repository/org [retention settings](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) if unset or `0` |
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Troubleshooting
 | 
					## Troubleshooting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
 | 
					See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Keep up-to-date with GitHub Dependabot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Want to contribute? Awesome! You can find information about contributing to
 | 
					Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
 | 
				
			||||||
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
 | 
					has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
 | 
				
			||||||
 | 
					to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					version: 2
 | 
				
			||||||
 | 
					updates:
 | 
				
			||||||
 | 
					  # Maintain dependencies for GitHub Actions
 | 
				
			||||||
 | 
					  - package-ecosystem: "github-actions"
 | 
				
			||||||
 | 
					    directory: "/"
 | 
				
			||||||
 | 
					    schedule:
 | 
				
			||||||
 | 
					      interval: "daily"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,7 @@ While pushing to a registry, you may encounter these kinds of issues:
 | 
				
			|||||||
* `unexpected response: 401 Unauthorized`
 | 
					* `unexpected response: 401 Unauthorized`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
These issues are not directly related to this action but are rather linked to
 | 
					These issues are not directly related to this action but are rather linked to
 | 
				
			||||||
[Buildx](https://github.com/docker/buildx), [BuildKit](https://github.com/moby/buildkit),
 | 
					[buildx](https://github.com/docker/buildx), [buildkit](https://github.com/moby/buildkit),
 | 
				
			||||||
[containerd](https://github.com/containerd/containerd) or the registry on which
 | 
					[containerd](https://github.com/containerd/containerd) or the registry on which
 | 
				
			||||||
you're pushing your image. The quality of error message depends on the registry
 | 
					you're pushing your image. The quality of error message depends on the registry
 | 
				
			||||||
and are usually not very informative.
 | 
					and are usually not very informative.
 | 
				
			||||||
@ -29,7 +29,7 @@ action step and attach BuildKit container logs to your issue.
 | 
				
			|||||||
### With containerd
 | 
					### With containerd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Next you can test pushing with [containerd action](https://github.com/crazy-max/ghaction-setup-containerd)
 | 
					Next you can test pushing with [containerd action](https://github.com/crazy-max/ghaction-setup-containerd)
 | 
				
			||||||
using the following workflow. If it works then open an issue on [BuildKit](https://github.com/moby/buildkit)
 | 
					using the following workflow. If it works then open an issue on [buildkit](https://github.com/moby/buildkit)
 | 
				
			||||||
repository.
 | 
					repository.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
@ -44,21 +44,21 @@ jobs:
 | 
				
			|||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Checkout
 | 
					        name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up QEMU
 | 
					        name: Set up QEMU
 | 
				
			||||||
        uses: docker/setup-qemu-action@v3
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up Docker Buildx
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
        uses: docker/setup-buildx-action@v3
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          buildkitd-flags: --debug
 | 
					          buildkitd-flags: --debug
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Set up containerd
 | 
					        name: Set up containerd
 | 
				
			||||||
        uses: crazy-max/ghaction-setup-containerd@v2
 | 
					        uses: crazy-max/ghaction-setup-containerd@v1
 | 
				
			||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build Docker image
 | 
					        name: Build Docker image
 | 
				
			||||||
        uses: docker/build-push-action@v6
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
          platforms: linux/amd64,linux/arm64
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
@ -105,13 +105,13 @@ to generate sanitized tags:
 | 
				
			|||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
- name: Docker meta
 | 
					- name: Docker meta
 | 
				
			||||||
  id: meta
 | 
					  id: meta
 | 
				
			||||||
  uses: docker/metadata-action@v4
 | 
					  uses: docker/metadata-action@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    images: ghcr.io/${{ github.repository }}
 | 
					    images: ghcr.io/${{ github.repository }}
 | 
				
			||||||
    tags: latest
 | 
					    tags: latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Build and push
 | 
					- name: Build and push
 | 
				
			||||||
  uses: docker/build-push-action@v6
 | 
					  uses: docker/build-push-action@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    context: .
 | 
					    context: .
 | 
				
			||||||
    push: true
 | 
					    push: true
 | 
				
			||||||
@ -122,14 +122,14 @@ Or a dedicated step to sanitize the slug:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
- name: Sanitize repo slug
 | 
					- name: Sanitize repo slug
 | 
				
			||||||
  uses: actions/github-script@v6
 | 
					  uses: actions/github-script@v4
 | 
				
			||||||
  id: repo_slug
 | 
					  id: repo_slug
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    result-encoding: string
 | 
					    result-encoding: string
 | 
				
			||||||
    script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
 | 
					    script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Build and push
 | 
					- name: Build and push
 | 
				
			||||||
  uses: docker/build-push-action@v6
 | 
					  uses: docker/build-push-action@v2
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    context: .
 | 
					    context: .
 | 
				
			||||||
    push: true
 | 
					    push: true
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										133
									
								
								UPGRADE.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								UPGRADE.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,133 @@
 | 
				
			|||||||
 | 
					# Upgrade notes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## v1 to v2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Input `path` is now called `context` for consistency with other Docker build tools
 | 
				
			||||||
 | 
					* `path` defaults to current git repository so checkout action is not required in a workflow
 | 
				
			||||||
 | 
					* Rename `dockerfile` input to `file` for consistency with other Docker build tools
 | 
				
			||||||
 | 
					* Rename `always_pull` input to `pull` for consistency with other Docker build tools
 | 
				
			||||||
 | 
					* Add `builder` input to be able to choose a builder instance through our [setup-buildx action](https://github.com/docker/setup-buildx-action)
 | 
				
			||||||
 | 
					* Add `platforms` input to support multi-platform builds
 | 
				
			||||||
 | 
					* Add `allow` input
 | 
				
			||||||
 | 
					* Add `load` input
 | 
				
			||||||
 | 
					* Add `outputs` input
 | 
				
			||||||
 | 
					* Add `cache-from` input (`cache_froms` removed)
 | 
				
			||||||
 | 
					* Add `cache-to` input
 | 
				
			||||||
 | 
					* Rename `build_args` input to `build-args` for consistency with other Docker build tools
 | 
				
			||||||
 | 
					* Add `secrets` input
 | 
				
			||||||
 | 
					* Review `tags` input
 | 
				
			||||||
 | 
					* Remove `repository` input. See [Simple workflow](#simple-workflow) for migration
 | 
				
			||||||
 | 
					* Remove `username`, `password` and `registry` inputs. Login support moved to [docker/login-action](https://github.com/docker/login-action) repo
 | 
				
			||||||
 | 
					* Remove `tag_with_sha`, `tag_with_ref`, `add_git_labels` inputs. See [Tags with ref and Git labels](#tags-with-ref-and-git-labels) for migration
 | 
				
			||||||
 | 
					* Handle Git context
 | 
				
			||||||
 | 
					* Add `digest` output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Simple workflow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					# v1
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Checkout
 | 
				
			||||||
 | 
					    uses: actions/checkout@v2
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Build and push Docker images
 | 
				
			||||||
 | 
					    uses: docker/build-push-action@v1
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      username: ${{ secrets.DOCKER_USERNAME }}
 | 
				
			||||||
 | 
					      password: ${{ secrets.DOCKER_PASSWORD }}
 | 
				
			||||||
 | 
					      repository: myorg/myrepository
 | 
				
			||||||
 | 
					      always_pull: true
 | 
				
			||||||
 | 
					      build_args: arg1=value1,arg2=value2
 | 
				
			||||||
 | 
					      cache_froms: myorg/myrepository:latest
 | 
				
			||||||
 | 
					      tags: latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					# v2
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Checkout
 | 
				
			||||||
 | 
					    uses: actions/checkout@v2
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Set up Docker Buildx
 | 
				
			||||||
 | 
					    uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Login to DockerHub
 | 
				
			||||||
 | 
					    uses: docker/login-action@v1
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      username: ${{ secrets.DOCKER_USERNAME }}
 | 
				
			||||||
 | 
					      password: ${{ secrets.DOCKER_PASSWORD }}
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Build and push
 | 
				
			||||||
 | 
					    uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      context: .
 | 
				
			||||||
 | 
					      pull: true
 | 
				
			||||||
 | 
					      push: true
 | 
				
			||||||
 | 
					      build-args: |
 | 
				
			||||||
 | 
					        arg1=value1
 | 
				
			||||||
 | 
					        arg2=value2
 | 
				
			||||||
 | 
					      cache-from: type=registry,ref=myorg/myrepository:latest
 | 
				
			||||||
 | 
					      cache-to: type=inline
 | 
				
			||||||
 | 
					      tags: myorg/myrepository:latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Tags with ref and Git labels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					# v1
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Checkout
 | 
				
			||||||
 | 
					    uses: actions/checkout@v2
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Build and push Docker images
 | 
				
			||||||
 | 
					    uses: docker/build-push-action@v1
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      username: ${{ secrets.DOCKER_USERNAME }}
 | 
				
			||||||
 | 
					      password: ${{ secrets.DOCKER_PASSWORD }}
 | 
				
			||||||
 | 
					      repository: myorg/myrepository
 | 
				
			||||||
 | 
					      push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					      tag_with_ref: true
 | 
				
			||||||
 | 
					      tag_with_sha: true
 | 
				
			||||||
 | 
					      add_git_labels: true
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					# v2
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Checkout
 | 
				
			||||||
 | 
					    uses: actions/checkout@v2
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Docker meta
 | 
				
			||||||
 | 
					    id: meta
 | 
				
			||||||
 | 
					    uses: docker/metadata-action@v3
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      images: |
 | 
				
			||||||
 | 
					        myorg/myrepository
 | 
				
			||||||
 | 
					      tags: |
 | 
				
			||||||
 | 
					        type=ref,event=branch
 | 
				
			||||||
 | 
					        type=ref,event=pr
 | 
				
			||||||
 | 
					        type=semver,pattern={{version}}
 | 
				
			||||||
 | 
					        type=sha
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Set up Docker Buildx
 | 
				
			||||||
 | 
					    uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Login to DockerHub
 | 
				
			||||||
 | 
					    if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					    uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      username: ${{ secrets.DOCKER_USERNAME }}
 | 
				
			||||||
 | 
					      password: ${{ secrets.DOCKER_PASSWORD }}
 | 
				
			||||||
 | 
					  -
 | 
				
			||||||
 | 
					    name: Build and push
 | 
				
			||||||
 | 
					    uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					    with:
 | 
				
			||||||
 | 
					      context: .
 | 
				
			||||||
 | 
					      push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					      tags: ${{ steps.meta.outputs.tags }}
 | 
				
			||||||
 | 
					      labels: ${{ steps.meta.outputs.labels }}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@ -1,207 +0,0 @@
 | 
				
			|||||||
import {jest} from '@jest/globals';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const context = {
 | 
					 | 
				
			||||||
  repo: {
 | 
					 | 
				
			||||||
    owner: 'docker',
 | 
					 | 
				
			||||||
    repo: 'build-push-action'
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  ref: 'refs/heads/master',
 | 
					 | 
				
			||||||
  runId: 123456789,
 | 
					 | 
				
			||||||
  payload: {
 | 
					 | 
				
			||||||
    after: '860c1904a1ce19322e91ac35af1ab07466440c37',
 | 
					 | 
				
			||||||
    base_ref: null,
 | 
					 | 
				
			||||||
    before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
 | 
					 | 
				
			||||||
    commits: [
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        author: {
 | 
					 | 
				
			||||||
          email: 'crazy-max@users.noreply.github.com',
 | 
					 | 
				
			||||||
          name: 'CrazyMax',
 | 
					 | 
				
			||||||
          username: 'crazy-max'
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        committer: {
 | 
					 | 
				
			||||||
          email: 'crazy-max@users.noreply.github.com',
 | 
					 | 
				
			||||||
          name: 'CrazyMax',
 | 
					 | 
				
			||||||
          username: 'crazy-max'
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        distinct: true,
 | 
					 | 
				
			||||||
        id: '860c1904a1ce19322e91ac35af1ab07466440c37',
 | 
					 | 
				
			||||||
        message: 'hello dev',
 | 
					 | 
				
			||||||
        timestamp: '2022-04-19T11:27:24+02:00',
 | 
					 | 
				
			||||||
        tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
 | 
					 | 
				
			||||||
        url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
    compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
 | 
					 | 
				
			||||||
    created: false,
 | 
					 | 
				
			||||||
    deleted: false,
 | 
					 | 
				
			||||||
    forced: false,
 | 
					 | 
				
			||||||
    head_commit: {
 | 
					 | 
				
			||||||
      author: {
 | 
					 | 
				
			||||||
        email: 'crazy-max@users.noreply.github.com',
 | 
					 | 
				
			||||||
        name: 'CrazyMax',
 | 
					 | 
				
			||||||
        username: 'crazy-max'
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      committer: {
 | 
					 | 
				
			||||||
        email: 'crazy-max@users.noreply.github.com',
 | 
					 | 
				
			||||||
        name: 'CrazyMax',
 | 
					 | 
				
			||||||
        username: 'crazy-max'
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      distinct: true,
 | 
					 | 
				
			||||||
      id: '860c1904a1ce19322e91ac35af1ab07466440c37',
 | 
					 | 
				
			||||||
      message: 'hello dev',
 | 
					 | 
				
			||||||
      timestamp: '2022-04-19T11:27:24+02:00',
 | 
					 | 
				
			||||||
      tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
 | 
					 | 
				
			||||||
      url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    organization: {
 | 
					 | 
				
			||||||
      avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
 | 
					 | 
				
			||||||
      description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
 | 
					 | 
				
			||||||
      events_url: 'https://api.github.com/orgs/docker/events',
 | 
					 | 
				
			||||||
      hooks_url: 'https://api.github.com/orgs/docker/hooks',
 | 
					 | 
				
			||||||
      id: 5429470,
 | 
					 | 
				
			||||||
      issues_url: 'https://api.github.com/orgs/docker/issues',
 | 
					 | 
				
			||||||
      login: 'docker',
 | 
					 | 
				
			||||||
      members_url: 'https://api.github.com/orgs/docker/members{/member}',
 | 
					 | 
				
			||||||
      node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
 | 
					 | 
				
			||||||
      public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
 | 
					 | 
				
			||||||
      repos_url: 'https://api.github.com/orgs/docker/repos',
 | 
					 | 
				
			||||||
      url: 'https://api.github.com/orgs/docker'
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    pusher: {
 | 
					 | 
				
			||||||
      email: 'github@crazymax.dev',
 | 
					 | 
				
			||||||
      name: 'crazy-max'
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    ref: 'refs/heads/dev',
 | 
					 | 
				
			||||||
    repository: {
 | 
					 | 
				
			||||||
      allow_forking: true,
 | 
					 | 
				
			||||||
      archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
 | 
					 | 
				
			||||||
      archived: false,
 | 
					 | 
				
			||||||
      assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
 | 
					 | 
				
			||||||
      blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
 | 
					 | 
				
			||||||
      branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
 | 
					 | 
				
			||||||
      clone_url: 'https://github.com/docker/test-docker-action.git',
 | 
					 | 
				
			||||||
      collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
 | 
					 | 
				
			||||||
      comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
 | 
					 | 
				
			||||||
      commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
 | 
					 | 
				
			||||||
      compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
 | 
					 | 
				
			||||||
      contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
 | 
					 | 
				
			||||||
      contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
 | 
					 | 
				
			||||||
      created_at: 1596792180,
 | 
					 | 
				
			||||||
      default_branch: 'master',
 | 
					 | 
				
			||||||
      deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
 | 
					 | 
				
			||||||
      description: 'Test "Docker" Actions',
 | 
					 | 
				
			||||||
      disabled: false,
 | 
					 | 
				
			||||||
      downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
 | 
					 | 
				
			||||||
      events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
 | 
					 | 
				
			||||||
      fork: false,
 | 
					 | 
				
			||||||
      forks: 1,
 | 
					 | 
				
			||||||
      forks_count: 1,
 | 
					 | 
				
			||||||
      forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
 | 
					 | 
				
			||||||
      full_name: 'docker/test-docker-action',
 | 
					 | 
				
			||||||
      git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
 | 
					 | 
				
			||||||
      git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
 | 
					 | 
				
			||||||
      git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
 | 
					 | 
				
			||||||
      git_url: 'git://github.com/docker/test-docker-action.git',
 | 
					 | 
				
			||||||
      has_downloads: true,
 | 
					 | 
				
			||||||
      has_issues: true,
 | 
					 | 
				
			||||||
      has_pages: false,
 | 
					 | 
				
			||||||
      has_projects: true,
 | 
					 | 
				
			||||||
      has_wiki: true,
 | 
					 | 
				
			||||||
      homepage: '',
 | 
					 | 
				
			||||||
      hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
 | 
					 | 
				
			||||||
      html_url: 'https://github.com/docker/test-docker-action',
 | 
					 | 
				
			||||||
      id: 285789493,
 | 
					 | 
				
			||||||
      is_template: false,
 | 
					 | 
				
			||||||
      issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
 | 
					 | 
				
			||||||
      issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
 | 
					 | 
				
			||||||
      issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
 | 
					 | 
				
			||||||
      keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
 | 
					 | 
				
			||||||
      labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
 | 
					 | 
				
			||||||
      language: 'JavaScript',
 | 
					 | 
				
			||||||
      languages_url: 'https://api.github.com/repos/docker/test-docker-action/languages',
 | 
					 | 
				
			||||||
      license: {
 | 
					 | 
				
			||||||
        key: 'mit',
 | 
					 | 
				
			||||||
        name: 'MIT License',
 | 
					 | 
				
			||||||
        node_id: 'MDc6TGljZW5zZTEz',
 | 
					 | 
				
			||||||
        spdx_id: 'MIT',
 | 
					 | 
				
			||||||
        url: 'https://api.github.com/licenses/mit'
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      master_branch: 'master',
 | 
					 | 
				
			||||||
      merges_url: 'https://api.github.com/repos/docker/test-docker-action/merges',
 | 
					 | 
				
			||||||
      milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
 | 
					 | 
				
			||||||
      mirror_url: null,
 | 
					 | 
				
			||||||
      name: 'test-docker-action',
 | 
					 | 
				
			||||||
      node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
 | 
					 | 
				
			||||||
      notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
 | 
					 | 
				
			||||||
      open_issues: 6,
 | 
					 | 
				
			||||||
      open_issues_count: 6,
 | 
					 | 
				
			||||||
      organization: 'docker',
 | 
					 | 
				
			||||||
      owner: {
 | 
					 | 
				
			||||||
        avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
 | 
					 | 
				
			||||||
        email: 'info@docker.com',
 | 
					 | 
				
			||||||
        events_url: 'https://api.github.com/users/docker/events{/privacy}',
 | 
					 | 
				
			||||||
        followers_url: 'https://api.github.com/users/docker/followers',
 | 
					 | 
				
			||||||
        following_url: 'https://api.github.com/users/docker/following{/other_user}',
 | 
					 | 
				
			||||||
        gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
 | 
					 | 
				
			||||||
        gravatar_id: '',
 | 
					 | 
				
			||||||
        html_url: 'https://github.com/docker',
 | 
					 | 
				
			||||||
        id: 5429470,
 | 
					 | 
				
			||||||
        login: 'docker',
 | 
					 | 
				
			||||||
        name: 'docker',
 | 
					 | 
				
			||||||
        node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
 | 
					 | 
				
			||||||
        organizations_url: 'https://api.github.com/users/docker/orgs',
 | 
					 | 
				
			||||||
        received_events_url: 'https://api.github.com/users/docker/received_events',
 | 
					 | 
				
			||||||
        repos_url: 'https://api.github.com/users/docker/repos',
 | 
					 | 
				
			||||||
        site_admin: false,
 | 
					 | 
				
			||||||
        starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
 | 
					 | 
				
			||||||
        subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
 | 
					 | 
				
			||||||
        type: 'Organization',
 | 
					 | 
				
			||||||
        url: 'https://api.github.com/users/docker'
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      private: true,
 | 
					 | 
				
			||||||
      pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
 | 
					 | 
				
			||||||
      pushed_at: 1650360446,
 | 
					 | 
				
			||||||
      releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
 | 
					 | 
				
			||||||
      size: 796,
 | 
					 | 
				
			||||||
      ssh_url: 'git@github.com:docker/test-docker-action.git',
 | 
					 | 
				
			||||||
      stargazers: 0,
 | 
					 | 
				
			||||||
      stargazers_count: 0,
 | 
					 | 
				
			||||||
      stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
 | 
					 | 
				
			||||||
      statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
 | 
					 | 
				
			||||||
      subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
 | 
					 | 
				
			||||||
      subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
 | 
					 | 
				
			||||||
      svn_url: 'https://github.com/docker/test-docker-action',
 | 
					 | 
				
			||||||
      tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
 | 
					 | 
				
			||||||
      teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
 | 
					 | 
				
			||||||
      topics: [],
 | 
					 | 
				
			||||||
      trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
 | 
					 | 
				
			||||||
      updated_at: '2022-04-19T09:05:09Z',
 | 
					 | 
				
			||||||
      url: 'https://github.com/docker/test-docker-action',
 | 
					 | 
				
			||||||
      visibility: 'private',
 | 
					 | 
				
			||||||
      watchers: 0,
 | 
					 | 
				
			||||||
      watchers_count: 0
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    sender: {
 | 
					 | 
				
			||||||
      avatar_url: 'https://avatars.githubusercontent.com/u/1951866?v=4',
 | 
					 | 
				
			||||||
      events_url: 'https://api.github.com/users/crazy-max/events{/privacy}',
 | 
					 | 
				
			||||||
      followers_url: 'https://api.github.com/users/crazy-max/followers',
 | 
					 | 
				
			||||||
      following_url: 'https://api.github.com/users/crazy-max/following{/other_user}',
 | 
					 | 
				
			||||||
      gists_url: 'https://api.github.com/users/crazy-max/gists{/gist_id}',
 | 
					 | 
				
			||||||
      gravatar_id: '',
 | 
					 | 
				
			||||||
      html_url: 'https://github.com/crazy-max',
 | 
					 | 
				
			||||||
      id: 1951866,
 | 
					 | 
				
			||||||
      login: 'crazy-max',
 | 
					 | 
				
			||||||
      node_id: 'MDQ6VXNlcjE5NTE4NjY=',
 | 
					 | 
				
			||||||
      organizations_url: 'https://api.github.com/users/crazy-max/orgs',
 | 
					 | 
				
			||||||
      received_events_url: 'https://api.github.com/users/crazy-max/received_events',
 | 
					 | 
				
			||||||
      repos_url: 'https://api.github.com/users/crazy-max/repos',
 | 
					 | 
				
			||||||
      site_admin: false,
 | 
					 | 
				
			||||||
      starred_url: 'https://api.github.com/users/crazy-max/starred{/owner}{/repo}',
 | 
					 | 
				
			||||||
      subscriptions_url: 'https://api.github.com/users/crazy-max/subscriptions',
 | 
					 | 
				
			||||||
      type: 'User',
 | 
					 | 
				
			||||||
      url: 'https://api.github.com/users/crazy-max'
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const getOctokit = jest.fn();
 | 
					 | 
				
			||||||
							
								
								
									
										193
									
								
								__tests__/buildx.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										193
									
								
								__tests__/buildx.test.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,193 @@
 | 
				
			|||||||
 | 
					import * as fs from 'fs';
 | 
				
			||||||
 | 
					import * as path from 'path';
 | 
				
			||||||
 | 
					import * as semver from 'semver';
 | 
				
			||||||
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import * as buildx from '../src/buildx';
 | 
				
			||||||
 | 
					import * as context from '../src/context';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const tmpNameSync = path.join('/tmp/.docker-build-push-jest', '.tmpname-jest').split(path.sep).join(path.posix.sep);
 | 
				
			||||||
 | 
					const imageID = 'sha256:bfb45ab72e46908183546477a08f8867fc40cebadd00af54b071b097aed127a9';
 | 
				
			||||||
 | 
					const metadata = `{
 | 
				
			||||||
 | 
					  "containerimage.config.digest": "sha256:059b68a595b22564a1cbc167af369349fdc2ecc1f7bc092c2235cbf601a795fd",
 | 
				
			||||||
 | 
					  "containerimage.digest": "sha256:b09b9482c72371486bb2c1d2c2a2633ed1d0b8389e12c8d52b9e052725c0c83c"
 | 
				
			||||||
 | 
					}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
 | 
				
			||||||
 | 
					  const tmpDir = path.join('/tmp/.docker-build-push-jest').split(path.sep).join(path.posix.sep);
 | 
				
			||||||
 | 
					  if (!fs.existsSync(tmpDir)) {
 | 
				
			||||||
 | 
					    fs.mkdirSync(tmpDir, {recursive: true});
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return tmpDir;
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
 | 
				
			||||||
 | 
					  return tmpNameSync;
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('getImageID', () => {
 | 
				
			||||||
 | 
					  it('matches', async () => {
 | 
				
			||||||
 | 
					    const imageIDFile = await buildx.getImageIDFile();
 | 
				
			||||||
 | 
					    await fs.writeFileSync(imageIDFile, imageID);
 | 
				
			||||||
 | 
					    const expected = await buildx.getImageID();
 | 
				
			||||||
 | 
					    expect(expected).toEqual(imageID);
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('getMetadata', () => {
 | 
				
			||||||
 | 
					  it('matches', async () => {
 | 
				
			||||||
 | 
					    const metadataFile = await buildx.getMetadataFile();
 | 
				
			||||||
 | 
					    await fs.writeFileSync(metadataFile, metadata);
 | 
				
			||||||
 | 
					    const expected = await buildx.getMetadata();
 | 
				
			||||||
 | 
					    expect(expected).toEqual(metadata);
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('getDigest', () => {
 | 
				
			||||||
 | 
					  it('matches', async () => {
 | 
				
			||||||
 | 
					    const metadataFile = await buildx.getMetadataFile();
 | 
				
			||||||
 | 
					    await fs.writeFileSync(metadataFile, metadata);
 | 
				
			||||||
 | 
					    const expected = await buildx.getDigest(metadata);
 | 
				
			||||||
 | 
					    expect(expected).toEqual('sha256:b09b9482c72371486bb2c1d2c2a2633ed1d0b8389e12c8d52b9e052725c0c83c');
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('isLocalOrTarExporter', () => {
 | 
				
			||||||
 | 
					  // prettier-ignore
 | 
				
			||||||
 | 
					  test.each([
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'type=registry,ref=user/app',
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'type=docker',
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'type=local,dest=./release-out'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'type=tar,dest=/tmp/image.tar'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'type=docker',
 | 
				
			||||||
 | 
					        'type=tar,dest=/tmp/image.tar'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        '"type=tar","dest=/tmp/image.tar"'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        '" type= local" , dest=./release-out'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    [
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        '.'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					  ])(
 | 
				
			||||||
 | 
					    'given %p returns %p',
 | 
				
			||||||
 | 
					    async (outputs: Array<string>, expected: boolean) => {
 | 
				
			||||||
 | 
					      expect(buildx.isLocalOrTarExporter(outputs)).toEqual(expected);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('isAvailable', () => {
 | 
				
			||||||
 | 
					  const execSpy: jest.SpyInstance = jest.spyOn(exec, 'getExecOutput');
 | 
				
			||||||
 | 
					  buildx.isAvailable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
 | 
				
			||||||
 | 
					    silent: true,
 | 
				
			||||||
 | 
					    ignoreReturnCode: true
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('getVersion', () => {
 | 
				
			||||||
 | 
					  async function isDaemonRunning() {
 | 
				
			||||||
 | 
					    return await exec
 | 
				
			||||||
 | 
					      .getExecOutput(`docker`, ['version', '--format', '{{.Server.Os}}'], {
 | 
				
			||||||
 | 
					        ignoreReturnCode: true,
 | 
				
			||||||
 | 
					        silent: true
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					      .then(res => {
 | 
				
			||||||
 | 
					        return !res.stdout.includes(' ') && res.exitCode == 0;
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  (isDaemonRunning() ? it : it.skip)(
 | 
				
			||||||
 | 
					    'valid',
 | 
				
			||||||
 | 
					    async () => {
 | 
				
			||||||
 | 
					      const version = await buildx.getVersion();
 | 
				
			||||||
 | 
					      expect(semver.valid(version)).not.toBeNull();
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    100000
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('parseVersion', () => {
 | 
				
			||||||
 | 
					  test.each([
 | 
				
			||||||
 | 
					    ['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
 | 
				
			||||||
 | 
					    ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
 | 
				
			||||||
 | 
					    ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'],
 | 
				
			||||||
 | 
					    ['github.com/docker/buildx f117971 f11797113e5a9b86bd976329c5dbb8a8bfdfadfa', 'f117971']
 | 
				
			||||||
 | 
					  ])('given %p', async (stdout, expected) => {
 | 
				
			||||||
 | 
					    expect(buildx.parseVersion(stdout)).toEqual(expected);
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('satisfies', () => {
 | 
				
			||||||
 | 
					  test.each([
 | 
				
			||||||
 | 
					    ['0.4.1', '>=0.3.2', true],
 | 
				
			||||||
 | 
					    ['bda4882a65349ca359216b135896bddc1d92461c', '>0.1.0', false],
 | 
				
			||||||
 | 
					    ['f117971', '>0.6.0', true]
 | 
				
			||||||
 | 
					  ])('given %p', async (version, range, expected) => {
 | 
				
			||||||
 | 
					    expect(buildx.satisfies(version, range)).toBe(expected);
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('getSecret', () => {
 | 
				
			||||||
 | 
					  test.each([
 | 
				
			||||||
 | 
					    ['A_SECRET=abcdef0123456789', false, 'A_SECRET', 'abcdef0123456789', false],
 | 
				
			||||||
 | 
					    ['GIT_AUTH_TOKEN=abcdefghijklmno=0123456789', false, 'GIT_AUTH_TOKEN', 'abcdefghijklmno=0123456789', false],
 | 
				
			||||||
 | 
					    ['MY_KEY=c3RyaW5nLXdpdGgtZXF1YWxzCg==', false, 'MY_KEY', 'c3RyaW5nLXdpdGgtZXF1YWxzCg==', false],
 | 
				
			||||||
 | 
					    ['aaaaaaaa', false, '', '', true],
 | 
				
			||||||
 | 
					    ['aaaaaaaa=', false, '', '', true],
 | 
				
			||||||
 | 
					    ['=bbbbbbb', false, '', '', true],
 | 
				
			||||||
 | 
					    [`foo=${path.join(__dirname, 'fixtures', 'secret.txt').split(path.sep).join(path.posix.sep)}`, true, 'foo', 'bar', false],
 | 
				
			||||||
 | 
					    [`notfound=secret`, true, '', '', true]
 | 
				
			||||||
 | 
					  ])('given %p key and %p secret', async (kvp, file, exKey, exValue, invalid) => {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      let secret: string;
 | 
				
			||||||
 | 
					      if (file) {
 | 
				
			||||||
 | 
					        secret = await buildx.getSecretFile(kvp);
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        secret = await buildx.getSecretString(kvp);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      expect(true).toBe(!invalid);
 | 
				
			||||||
 | 
					      expect(secret).toEqual(`id=${exKey},src=${tmpNameSync}`);
 | 
				
			||||||
 | 
					      const secretValue = await fs.readFileSync(tmpNameSync, 'utf-8');
 | 
				
			||||||
 | 
					      expect(secretValue).toEqual(exValue);
 | 
				
			||||||
 | 
					    } catch (err) {
 | 
				
			||||||
 | 
					      expect(true).toBe(invalid);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,362 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "id": 1296269,
 | 
					 | 
				
			||||||
  "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
 | 
					 | 
				
			||||||
  "name": "Hello-World",
 | 
					 | 
				
			||||||
  "full_name": "octocat/Hello-World",
 | 
					 | 
				
			||||||
  "owner": {
 | 
					 | 
				
			||||||
    "login": "octocat",
 | 
					 | 
				
			||||||
    "id": 1,
 | 
					 | 
				
			||||||
    "node_id": "MDQ6VXNlcjE=",
 | 
					 | 
				
			||||||
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
 | 
					 | 
				
			||||||
    "gravatar_id": "",
 | 
					 | 
				
			||||||
    "url": "https://api.github.com/users/octocat",
 | 
					 | 
				
			||||||
    "html_url": "https://github.com/octocat",
 | 
					 | 
				
			||||||
    "followers_url": "https://api.github.com/users/octocat/followers",
 | 
					 | 
				
			||||||
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
 | 
					 | 
				
			||||||
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
 | 
					 | 
				
			||||||
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
 | 
					 | 
				
			||||||
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
 | 
					 | 
				
			||||||
    "organizations_url": "https://api.github.com/users/octocat/orgs",
 | 
					 | 
				
			||||||
    "repos_url": "https://api.github.com/users/octocat/repos",
 | 
					 | 
				
			||||||
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
 | 
					 | 
				
			||||||
    "received_events_url": "https://api.github.com/users/octocat/received_events",
 | 
					 | 
				
			||||||
    "type": "User",
 | 
					 | 
				
			||||||
    "site_admin": false
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "private": false,
 | 
					 | 
				
			||||||
  "html_url": "https://github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
  "description": "This your first repo!",
 | 
					 | 
				
			||||||
  "fork": false,
 | 
					 | 
				
			||||||
  "url": "https://api.github.com/repos/octocat/Hello-World",
 | 
					 | 
				
			||||||
  "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
 | 
					 | 
				
			||||||
  "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
 | 
					 | 
				
			||||||
  "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
 | 
					 | 
				
			||||||
  "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
 | 
					 | 
				
			||||||
  "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
 | 
					 | 
				
			||||||
  "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
 | 
					 | 
				
			||||||
  "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
 | 
					 | 
				
			||||||
  "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
 | 
					 | 
				
			||||||
  "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
 | 
					 | 
				
			||||||
  "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
 | 
					 | 
				
			||||||
  "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
 | 
					 | 
				
			||||||
  "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
 | 
					 | 
				
			||||||
  "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
 | 
					 | 
				
			||||||
  "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
 | 
					 | 
				
			||||||
  "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
 | 
					 | 
				
			||||||
  "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
 | 
					 | 
				
			||||||
  "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
 | 
					 | 
				
			||||||
  "git_url": "git:github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
  "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
 | 
					 | 
				
			||||||
  "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
 | 
					 | 
				
			||||||
  "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
 | 
					 | 
				
			||||||
  "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
 | 
					 | 
				
			||||||
  "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
 | 
					 | 
				
			||||||
  "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
 | 
					 | 
				
			||||||
  "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
 | 
					 | 
				
			||||||
  "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
 | 
					 | 
				
			||||||
  "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
 | 
					 | 
				
			||||||
  "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
 | 
					 | 
				
			||||||
  "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
 | 
					 | 
				
			||||||
  "ssh_url": "git@github.com:octocat/Hello-World.git",
 | 
					 | 
				
			||||||
  "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
 | 
					 | 
				
			||||||
  "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
 | 
					 | 
				
			||||||
  "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
 | 
					 | 
				
			||||||
  "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
 | 
					 | 
				
			||||||
  "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
 | 
					 | 
				
			||||||
  "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
 | 
					 | 
				
			||||||
  "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
 | 
					 | 
				
			||||||
  "clone_url": "https://github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
  "mirror_url": "git:git.example.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
  "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
 | 
					 | 
				
			||||||
  "svn_url": "https://svn.github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
  "homepage": "https://github.com",
 | 
					 | 
				
			||||||
  "language": null,
 | 
					 | 
				
			||||||
  "forks_count": 9,
 | 
					 | 
				
			||||||
  "stargazers_count": 80,
 | 
					 | 
				
			||||||
  "watchers_count": 80,
 | 
					 | 
				
			||||||
  "size": 108,
 | 
					 | 
				
			||||||
  "default_branch": "master",
 | 
					 | 
				
			||||||
  "open_issues_count": 0,
 | 
					 | 
				
			||||||
  "is_template": true,
 | 
					 | 
				
			||||||
  "topics": [
 | 
					 | 
				
			||||||
    "octocat",
 | 
					 | 
				
			||||||
    "atom",
 | 
					 | 
				
			||||||
    "electron",
 | 
					 | 
				
			||||||
    "api"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "has_issues": true,
 | 
					 | 
				
			||||||
  "has_projects": true,
 | 
					 | 
				
			||||||
  "has_wiki": true,
 | 
					 | 
				
			||||||
  "has_pages": false,
 | 
					 | 
				
			||||||
  "has_downloads": true,
 | 
					 | 
				
			||||||
  "archived": false,
 | 
					 | 
				
			||||||
  "disabled": false,
 | 
					 | 
				
			||||||
  "visibility": "public",
 | 
					 | 
				
			||||||
  "pushed_at": "2011-01-26T19:06:43Z",
 | 
					 | 
				
			||||||
  "created_at": "2011-01-26T19:01:12Z",
 | 
					 | 
				
			||||||
  "updated_at": "2011-01-26T19:14:43Z",
 | 
					 | 
				
			||||||
  "permissions": {
 | 
					 | 
				
			||||||
    "pull": true,
 | 
					 | 
				
			||||||
    "triage": true,
 | 
					 | 
				
			||||||
    "push": false,
 | 
					 | 
				
			||||||
    "maintain": false,
 | 
					 | 
				
			||||||
    "admin": false
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "allow_rebase_merge": true,
 | 
					 | 
				
			||||||
  "template_repository": null,
 | 
					 | 
				
			||||||
  "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
 | 
					 | 
				
			||||||
  "allow_squash_merge": true,
 | 
					 | 
				
			||||||
  "delete_branch_on_merge": true,
 | 
					 | 
				
			||||||
  "allow_merge_commit": true,
 | 
					 | 
				
			||||||
  "subscribers_count": 42,
 | 
					 | 
				
			||||||
  "network_count": 0,
 | 
					 | 
				
			||||||
  "license": {
 | 
					 | 
				
			||||||
    "key": "mit",
 | 
					 | 
				
			||||||
    "name": "MIT License",
 | 
					 | 
				
			||||||
    "spdx_id": "MIT",
 | 
					 | 
				
			||||||
    "url": "https://api.github.com/licenses/mit",
 | 
					 | 
				
			||||||
    "node_id": "MDc6TGljZW5zZW1pdA=="
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "organization": {
 | 
					 | 
				
			||||||
    "login": "octocat",
 | 
					 | 
				
			||||||
    "id": 1,
 | 
					 | 
				
			||||||
    "node_id": "MDQ6VXNlcjE=",
 | 
					 | 
				
			||||||
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
 | 
					 | 
				
			||||||
    "gravatar_id": "",
 | 
					 | 
				
			||||||
    "url": "https://api.github.com/users/octocat",
 | 
					 | 
				
			||||||
    "html_url": "https://github.com/octocat",
 | 
					 | 
				
			||||||
    "followers_url": "https://api.github.com/users/octocat/followers",
 | 
					 | 
				
			||||||
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
 | 
					 | 
				
			||||||
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
 | 
					 | 
				
			||||||
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
 | 
					 | 
				
			||||||
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
 | 
					 | 
				
			||||||
    "organizations_url": "https://api.github.com/users/octocat/orgs",
 | 
					 | 
				
			||||||
    "repos_url": "https://api.github.com/users/octocat/repos",
 | 
					 | 
				
			||||||
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
 | 
					 | 
				
			||||||
    "received_events_url": "https://api.github.com/users/octocat/received_events",
 | 
					 | 
				
			||||||
    "type": "Organization",
 | 
					 | 
				
			||||||
    "site_admin": false
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "parent": {
 | 
					 | 
				
			||||||
    "id": 1296269,
 | 
					 | 
				
			||||||
    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
 | 
					 | 
				
			||||||
    "name": "Hello-World",
 | 
					 | 
				
			||||||
    "full_name": "octocat/Hello-World",
 | 
					 | 
				
			||||||
    "owner": {
 | 
					 | 
				
			||||||
      "login": "octocat",
 | 
					 | 
				
			||||||
      "id": 1,
 | 
					 | 
				
			||||||
      "node_id": "MDQ6VXNlcjE=",
 | 
					 | 
				
			||||||
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
 | 
					 | 
				
			||||||
      "gravatar_id": "",
 | 
					 | 
				
			||||||
      "url": "https://api.github.com/users/octocat",
 | 
					 | 
				
			||||||
      "html_url": "https://github.com/octocat",
 | 
					 | 
				
			||||||
      "followers_url": "https://api.github.com/users/octocat/followers",
 | 
					 | 
				
			||||||
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
 | 
					 | 
				
			||||||
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
 | 
					 | 
				
			||||||
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
 | 
					 | 
				
			||||||
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
 | 
					 | 
				
			||||||
      "organizations_url": "https://api.github.com/users/octocat/orgs",
 | 
					 | 
				
			||||||
      "repos_url": "https://api.github.com/users/octocat/repos",
 | 
					 | 
				
			||||||
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
 | 
					 | 
				
			||||||
      "received_events_url": "https://api.github.com/users/octocat/received_events",
 | 
					 | 
				
			||||||
      "type": "User",
 | 
					 | 
				
			||||||
      "site_admin": false
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "private": false,
 | 
					 | 
				
			||||||
    "html_url": "https://github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "description": "This your first repo!",
 | 
					 | 
				
			||||||
    "fork": false,
 | 
					 | 
				
			||||||
    "url": "https://api.github.com/repos/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
 | 
					 | 
				
			||||||
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
 | 
					 | 
				
			||||||
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
 | 
					 | 
				
			||||||
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
 | 
					 | 
				
			||||||
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
 | 
					 | 
				
			||||||
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
 | 
					 | 
				
			||||||
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
 | 
					 | 
				
			||||||
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
 | 
					 | 
				
			||||||
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
 | 
					 | 
				
			||||||
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
 | 
					 | 
				
			||||||
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
 | 
					 | 
				
			||||||
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
 | 
					 | 
				
			||||||
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
 | 
					 | 
				
			||||||
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
 | 
					 | 
				
			||||||
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
 | 
					 | 
				
			||||||
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
 | 
					 | 
				
			||||||
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
 | 
					 | 
				
			||||||
    "git_url": "git:github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
 | 
					 | 
				
			||||||
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
 | 
					 | 
				
			||||||
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
 | 
					 | 
				
			||||||
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
 | 
					 | 
				
			||||||
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
 | 
					 | 
				
			||||||
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
 | 
					 | 
				
			||||||
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
 | 
					 | 
				
			||||||
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
 | 
					 | 
				
			||||||
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
 | 
					 | 
				
			||||||
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
 | 
					 | 
				
			||||||
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
 | 
					 | 
				
			||||||
    "ssh_url": "git@github.com:octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
 | 
					 | 
				
			||||||
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
 | 
					 | 
				
			||||||
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
 | 
					 | 
				
			||||||
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
 | 
					 | 
				
			||||||
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
 | 
					 | 
				
			||||||
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
 | 
					 | 
				
			||||||
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
 | 
					 | 
				
			||||||
    "clone_url": "https://github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "mirror_url": "git:git.example.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
 | 
					 | 
				
			||||||
    "svn_url": "https://svn.github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "homepage": "https://github.com",
 | 
					 | 
				
			||||||
    "language": null,
 | 
					 | 
				
			||||||
    "forks_count": 9,
 | 
					 | 
				
			||||||
    "stargazers_count": 80,
 | 
					 | 
				
			||||||
    "watchers_count": 80,
 | 
					 | 
				
			||||||
    "size": 108,
 | 
					 | 
				
			||||||
    "default_branch": "master",
 | 
					 | 
				
			||||||
    "open_issues_count": 0,
 | 
					 | 
				
			||||||
    "is_template": true,
 | 
					 | 
				
			||||||
    "topics": [
 | 
					 | 
				
			||||||
      "octocat",
 | 
					 | 
				
			||||||
      "atom",
 | 
					 | 
				
			||||||
      "electron",
 | 
					 | 
				
			||||||
      "api"
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
    "has_issues": true,
 | 
					 | 
				
			||||||
    "has_projects": true,
 | 
					 | 
				
			||||||
    "has_wiki": true,
 | 
					 | 
				
			||||||
    "has_pages": false,
 | 
					 | 
				
			||||||
    "has_downloads": true,
 | 
					 | 
				
			||||||
    "archived": false,
 | 
					 | 
				
			||||||
    "disabled": false,
 | 
					 | 
				
			||||||
    "visibility": "public",
 | 
					 | 
				
			||||||
    "pushed_at": "2011-01-26T19:06:43Z",
 | 
					 | 
				
			||||||
    "created_at": "2011-01-26T19:01:12Z",
 | 
					 | 
				
			||||||
    "updated_at": "2011-01-26T19:14:43Z",
 | 
					 | 
				
			||||||
    "permissions": {
 | 
					 | 
				
			||||||
      "admin": false,
 | 
					 | 
				
			||||||
      "push": false,
 | 
					 | 
				
			||||||
      "pull": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "allow_rebase_merge": true,
 | 
					 | 
				
			||||||
    "template_repository": null,
 | 
					 | 
				
			||||||
    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
 | 
					 | 
				
			||||||
    "allow_squash_merge": true,
 | 
					 | 
				
			||||||
    "delete_branch_on_merge": true,
 | 
					 | 
				
			||||||
    "allow_merge_commit": true,
 | 
					 | 
				
			||||||
    "subscribers_count": 42,
 | 
					 | 
				
			||||||
    "network_count": 0
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "source": {
 | 
					 | 
				
			||||||
    "id": 1296269,
 | 
					 | 
				
			||||||
    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
 | 
					 | 
				
			||||||
    "name": "Hello-World",
 | 
					 | 
				
			||||||
    "full_name": "octocat/Hello-World",
 | 
					 | 
				
			||||||
    "owner": {
 | 
					 | 
				
			||||||
      "login": "octocat",
 | 
					 | 
				
			||||||
      "id": 1,
 | 
					 | 
				
			||||||
      "node_id": "MDQ6VXNlcjE=",
 | 
					 | 
				
			||||||
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
 | 
					 | 
				
			||||||
      "gravatar_id": "",
 | 
					 | 
				
			||||||
      "url": "https://api.github.com/users/octocat",
 | 
					 | 
				
			||||||
      "html_url": "https://github.com/octocat",
 | 
					 | 
				
			||||||
      "followers_url": "https://api.github.com/users/octocat/followers",
 | 
					 | 
				
			||||||
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
 | 
					 | 
				
			||||||
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
 | 
					 | 
				
			||||||
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
 | 
					 | 
				
			||||||
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
 | 
					 | 
				
			||||||
      "organizations_url": "https://api.github.com/users/octocat/orgs",
 | 
					 | 
				
			||||||
      "repos_url": "https://api.github.com/users/octocat/repos",
 | 
					 | 
				
			||||||
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
 | 
					 | 
				
			||||||
      "received_events_url": "https://api.github.com/users/octocat/received_events",
 | 
					 | 
				
			||||||
      "type": "User",
 | 
					 | 
				
			||||||
      "site_admin": false
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "private": false,
 | 
					 | 
				
			||||||
    "html_url": "https://github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "description": "This your first repo!",
 | 
					 | 
				
			||||||
    "fork": false,
 | 
					 | 
				
			||||||
    "url": "https://api.github.com/repos/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
 | 
					 | 
				
			||||||
    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
 | 
					 | 
				
			||||||
    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
 | 
					 | 
				
			||||||
    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
 | 
					 | 
				
			||||||
    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
 | 
					 | 
				
			||||||
    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
 | 
					 | 
				
			||||||
    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
 | 
					 | 
				
			||||||
    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
 | 
					 | 
				
			||||||
    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
 | 
					 | 
				
			||||||
    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
 | 
					 | 
				
			||||||
    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
 | 
					 | 
				
			||||||
    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
 | 
					 | 
				
			||||||
    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
 | 
					 | 
				
			||||||
    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
 | 
					 | 
				
			||||||
    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
 | 
					 | 
				
			||||||
    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
 | 
					 | 
				
			||||||
    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
 | 
					 | 
				
			||||||
    "git_url": "git:github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
 | 
					 | 
				
			||||||
    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
 | 
					 | 
				
			||||||
    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
 | 
					 | 
				
			||||||
    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
 | 
					 | 
				
			||||||
    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
 | 
					 | 
				
			||||||
    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
 | 
					 | 
				
			||||||
    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
 | 
					 | 
				
			||||||
    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
 | 
					 | 
				
			||||||
    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
 | 
					 | 
				
			||||||
    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
 | 
					 | 
				
			||||||
    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
 | 
					 | 
				
			||||||
    "ssh_url": "git@github.com:octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
 | 
					 | 
				
			||||||
    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
 | 
					 | 
				
			||||||
    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
 | 
					 | 
				
			||||||
    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
 | 
					 | 
				
			||||||
    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
 | 
					 | 
				
			||||||
    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
 | 
					 | 
				
			||||||
    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
 | 
					 | 
				
			||||||
    "clone_url": "https://github.com/octocat/Hello-World.git",
 | 
					 | 
				
			||||||
    "mirror_url": "git:git.example.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
 | 
					 | 
				
			||||||
    "svn_url": "https://svn.github.com/octocat/Hello-World",
 | 
					 | 
				
			||||||
    "homepage": "https://github.com",
 | 
					 | 
				
			||||||
    "language": null,
 | 
					 | 
				
			||||||
    "forks_count": 9,
 | 
					 | 
				
			||||||
    "stargazers_count": 80,
 | 
					 | 
				
			||||||
    "watchers_count": 80,
 | 
					 | 
				
			||||||
    "size": 108,
 | 
					 | 
				
			||||||
    "default_branch": "master",
 | 
					 | 
				
			||||||
    "open_issues_count": 0,
 | 
					 | 
				
			||||||
    "is_template": true,
 | 
					 | 
				
			||||||
    "topics": [
 | 
					 | 
				
			||||||
      "octocat",
 | 
					 | 
				
			||||||
      "atom",
 | 
					 | 
				
			||||||
      "electron",
 | 
					 | 
				
			||||||
      "api"
 | 
					 | 
				
			||||||
    ],
 | 
					 | 
				
			||||||
    "has_issues": true,
 | 
					 | 
				
			||||||
    "has_projects": true,
 | 
					 | 
				
			||||||
    "has_wiki": true,
 | 
					 | 
				
			||||||
    "has_pages": false,
 | 
					 | 
				
			||||||
    "has_downloads": true,
 | 
					 | 
				
			||||||
    "archived": false,
 | 
					 | 
				
			||||||
    "disabled": false,
 | 
					 | 
				
			||||||
    "visibility": "public",
 | 
					 | 
				
			||||||
    "pushed_at": "2011-01-26T19:06:43Z",
 | 
					 | 
				
			||||||
    "created_at": "2011-01-26T19:01:12Z",
 | 
					 | 
				
			||||||
    "updated_at": "2011-01-26T19:14:43Z",
 | 
					 | 
				
			||||||
    "permissions": {
 | 
					 | 
				
			||||||
      "admin": false,
 | 
					 | 
				
			||||||
      "push": false,
 | 
					 | 
				
			||||||
      "pull": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "allow_rebase_merge": true,
 | 
					 | 
				
			||||||
    "template_repository": null,
 | 
					 | 
				
			||||||
    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
 | 
					 | 
				
			||||||
    "allow_squash_merge": true,
 | 
					 | 
				
			||||||
    "delete_branch_on_merge": true,
 | 
					 | 
				
			||||||
    "allow_merge_commit": true,
 | 
					 | 
				
			||||||
    "subscribers_count": 42,
 | 
					 | 
				
			||||||
    "network_count": 0
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										23
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								action.yml
									
									
									
									
									
								
							@ -13,12 +13,6 @@ inputs:
 | 
				
			|||||||
  allow:
 | 
					  allow:
 | 
				
			||||||
    description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
 | 
					    description: "List of extra privileged entitlement (e.g., network.host,security.insecure)"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
  annotations:
 | 
					 | 
				
			||||||
    description: "List of annotation to set to the image"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  attests:
 | 
					 | 
				
			||||||
    description: "List of attestation parameters (e.g., type=sbom,generator=image)"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  build-args:
 | 
					  build-args:
 | 
				
			||||||
    description: "List of build-time variables"
 | 
					    description: "List of build-time variables"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -34,9 +28,6 @@ inputs:
 | 
				
			|||||||
  cache-to:
 | 
					  cache-to:
 | 
				
			||||||
    description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
 | 
					    description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
  call:
 | 
					 | 
				
			||||||
    description: "Set method for evaluating build (e.g., check)"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  cgroup-parent:
 | 
					  cgroup-parent:
 | 
				
			||||||
    description: "Optional parent cgroup for the container used in the build"
 | 
					    description: "Optional parent cgroup for the container used in the build"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -60,18 +51,12 @@ inputs:
 | 
				
			|||||||
    description: "Do not use cache when building the image"
 | 
					    description: "Do not use cache when building the image"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
    default: 'false'
 | 
					    default: 'false'
 | 
				
			||||||
  no-cache-filters:
 | 
					 | 
				
			||||||
    description: "Do not cache specified stages"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  outputs:
 | 
					  outputs:
 | 
				
			||||||
    description: "List of output destinations (format: type=local,dest=path)"
 | 
					    description: "List of output destinations (format: type=local,dest=path)"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
  platforms:
 | 
					  platforms:
 | 
				
			||||||
    description: "List of target platforms for build"
 | 
					    description: "List of target platforms for build"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
  provenance:
 | 
					 | 
				
			||||||
    description: "Generate provenance attestation for the build (shorthand for --attest=type=provenance)"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  pull:
 | 
					  pull:
 | 
				
			||||||
    description: "Always attempt to pull all referenced images"
 | 
					    description: "Always attempt to pull all referenced images"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -80,15 +65,9 @@ inputs:
 | 
				
			|||||||
    description: "Push is a shorthand for --output=type=registry"
 | 
					    description: "Push is a shorthand for --output=type=registry"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
    default: 'false'
 | 
					    default: 'false'
 | 
				
			||||||
  sbom:
 | 
					 | 
				
			||||||
    description: "Generate SBOM attestation for the build (shorthand for --attest=type=sbom)"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  secrets:
 | 
					  secrets:
 | 
				
			||||||
    description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)"
 | 
					    description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
  secret-envs:
 | 
					 | 
				
			||||||
    description: "List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR)"
 | 
					 | 
				
			||||||
    required: false
 | 
					 | 
				
			||||||
  secret-files:
 | 
					  secret-files:
 | 
				
			||||||
    description: "List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)"
 | 
					    description: "List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)"
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
@ -121,6 +100,6 @@ outputs:
 | 
				
			|||||||
    description: 'Build result metadata'
 | 
					    description: 'Build result metadata'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
runs:
 | 
					runs:
 | 
				
			||||||
  using: 'node20'
 | 
					  using: 'node12'
 | 
				
			||||||
  main: 'dist/index.js'
 | 
					  main: 'dist/index.js'
 | 
				
			||||||
  post: 'dist/index.js'
 | 
					  post: 'dist/index.js'
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										27956
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										27956
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										3924
									
								
								dist/licenses.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3924
									
								
								dist/licenses.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1
									
								
								dist/sourcemap-register.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/sourcemap-register.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -1,6 +1,10 @@
 | 
				
			|||||||
target "_common" {
 | 
					variable "NODE_VERSION" {
 | 
				
			||||||
 | 
					  default = "12"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target "node-version" {
 | 
				
			||||||
  args = {
 | 
					  args = {
 | 
				
			||||||
    BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
 | 
					    NODE_VERSION = NODE_VERSION
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -9,58 +13,58 @@ group "default" {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
group "pre-checkin" {
 | 
					group "pre-checkin" {
 | 
				
			||||||
  targets = ["vendor", "format", "build"]
 | 
					  targets = ["vendor-update", "format", "build"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
group "validate" {
 | 
					group "validate" {
 | 
				
			||||||
  targets = ["lint", "build-validate", "vendor-validate"]
 | 
					  targets = ["format-validate", "build-validate", "vendor-validate"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "build" {
 | 
					target "build" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "build-update"
 | 
					  target = "build-update"
 | 
				
			||||||
  output = ["."]
 | 
					  output = ["."]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "build-validate" {
 | 
					target "build-validate" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "build-validate"
 | 
					  target = "build-validate"
 | 
				
			||||||
  output = ["type=cacheonly"]
 | 
					  output = ["type=cacheonly"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "format" {
 | 
					target "format" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "format-update"
 | 
					  target = "format-update"
 | 
				
			||||||
  output = ["."]
 | 
					  output = ["."]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "lint" {
 | 
					target "format-validate" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "lint"
 | 
					  target = "format-validate"
 | 
				
			||||||
  output = ["type=cacheonly"]
 | 
					  output = ["type=cacheonly"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "vendor" {
 | 
					target "vendor-update" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "vendor-update"
 | 
					  target = "vendor-update"
 | 
				
			||||||
  output = ["."]
 | 
					  output = ["."]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "vendor-validate" {
 | 
					target "vendor-validate" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "vendor-validate"
 | 
					  target = "vendor-validate"
 | 
				
			||||||
  output = ["type=cacheonly"]
 | 
					  output = ["type=cacheonly"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
target "test" {
 | 
					target "test" {
 | 
				
			||||||
  inherits = ["_common"]
 | 
					  inherits = ["node-version"]
 | 
				
			||||||
  dockerfile = "dev.Dockerfile"
 | 
					  dockerfile = "./hack/build.Dockerfile"
 | 
				
			||||||
  target = "test-coverage"
 | 
					  target = "test-coverage"
 | 
				
			||||||
  output = ["./coverage"]
 | 
					  output = ["./coverage"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										200
									
								
								docs/advanced/cache.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								docs/advanced/cache.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,200 @@
 | 
				
			|||||||
 | 
					# Cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* [Inline cache](#inline-cache)
 | 
				
			||||||
 | 
					* [Registry cache](#registry-cache)
 | 
				
			||||||
 | 
					* [GitHub cache](#github-cache)
 | 
				
			||||||
 | 
					  * [Cache backend API](#cache-backend-api)
 | 
				
			||||||
 | 
					  * [Local cache](#local-cache)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> More info about cache on [BuildKit](https://github.com/moby/buildkit#export-cache) and [Buildx](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) repositories.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Inline cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In most cases you want to use the [`type=inline` cache exporter](https://github.com/moby/buildkit#inline-push-image-and-cache-together).
 | 
				
			||||||
 | 
					However, note that the `inline` cache exporter only supports `min` cache mode. To enable `max` cache mode, push the
 | 
				
			||||||
 | 
					image and the cache separately by using the `registry` cache exporter as shown in the [next example](#registry-cache).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					          cache-from: type=registry,ref=user/app:latest
 | 
				
			||||||
 | 
					          cache-to: type=inline
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Registry cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can import/export cache from a cache manifest or (special) image configuration on the registry with the
 | 
				
			||||||
 | 
					[`type=registry` cache exporter](https://github.com/moby/buildkit/tree/master#registry-push-image-and-cache-separately).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					          cache-from: type=registry,ref=user/app:buildcache
 | 
				
			||||||
 | 
					          cache-to: type=registry,ref=user/app:buildcache,mode=max
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## GitHub cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Cache backend API
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :test_tube: This cache exporter is considered EXPERIMENTAL until further notice. Please provide feedback on
 | 
				
			||||||
 | 
					> [BuildKit repository](https://github.com/moby/buildkit) if you encounter any issues.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Since [buildx 0.6.0](https://github.com/docker/buildx/releases/tag/v0.6.0) and [BuildKit 0.9.0](https://github.com/moby/buildkit/releases/tag/v0.9.0),
 | 
				
			||||||
 | 
					you can use the [`type=gha` cache exporter](https://github.com/moby/buildkit/tree/master#github-actions-cache-experimental).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GitHub Actions cache exporter backend uses the [GitHub Cache API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md)
 | 
				
			||||||
 | 
					to fetch and upload cache blobs. That's why this type of cache should be exclusively used in a GitHub Action workflow
 | 
				
			||||||
 | 
					as the `url` (`$ACTIONS_CACHE_URL`) and `token` (`$ACTIONS_RUNTIME_TOKEN`) attributes are populated when a workflow
 | 
				
			||||||
 | 
					is started.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					          cache-from: type=gha
 | 
				
			||||||
 | 
					          cache-to: type=gha,mode=max
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Local cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :warning: At the moment caches are copied over the existing cache so it [keeps growing](https://github.com/docker/build-push-action/issues/252).
 | 
				
			||||||
 | 
					> The `Move cache` step is used as a temporary fix (see https://github.com/moby/buildkit/issues/1896).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can also leverage [GitHub cache](https://docs.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)
 | 
				
			||||||
 | 
					using [actions/cache](https://github.com/actions/cache) and [`type=local` cache exporter](https://github.com/moby/buildkit#local-directory-1)
 | 
				
			||||||
 | 
					with this action:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Cache Docker layers
 | 
				
			||||||
 | 
					        uses: actions/cache@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          path: /tmp/.buildx-cache
 | 
				
			||||||
 | 
					          key: ${{ runner.os }}-buildx-${{ github.sha }}
 | 
				
			||||||
 | 
					          restore-keys: |
 | 
				
			||||||
 | 
					            ${{ runner.os }}-buildx-
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					          cache-from: type=local,src=/tmp/.buildx-cache
 | 
				
			||||||
 | 
					          cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        # Temp fix
 | 
				
			||||||
 | 
					        # https://github.com/docker/build-push-action/issues/252
 | 
				
			||||||
 | 
					        # https://github.com/moby/buildkit/issues/1896
 | 
				
			||||||
 | 
					        name: Move cache
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          rm -rf /tmp/.buildx-cache
 | 
				
			||||||
 | 
					          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										73
									
								
								docs/advanced/copy-between-registries.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								docs/advanced/copy-between-registries.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					# Copy images between registries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Multi-platform images built using buildx can be copied from one registry to another without
 | 
				
			||||||
 | 
					changing the image SHA using the [tag-push-action](https://github.com/akhilerm/tag-push-action).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The following workflow will first push the image to dockerhub, run some tests using the images
 | 
				
			||||||
 | 
					and then push to quay and ghcr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - 
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      - # quay and ghcr logins for pushing image after testing
 | 
				
			||||||
 | 
					        name: Login to Quay Registry
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          registry: quay.io
 | 
				
			||||||
 | 
					          username: ${{ secrets.QUAY_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.QUAY_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to GitHub Container Registry
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          registry: ghcr.io
 | 
				
			||||||
 | 
					          username: ${{ github.repository_owner }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            user/app:latest
 | 
				
			||||||
 | 
					            user/app:1.0.0
 | 
				
			||||||
 | 
					      - # run tests using image from docker hub
 | 
				
			||||||
 | 
					        name: Run Tests
 | 
				
			||||||
 | 
					        run: make tests
 | 
				
			||||||
 | 
					      - # copy multiplatform image from dockerhub to quay and ghcr
 | 
				
			||||||
 | 
					        name: Push Image to multiple registries
 | 
				
			||||||
 | 
					        uses: akhilerm/tag-push-action@v2.0.0
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          src: docker.io/user/app:1.0.0
 | 
				
			||||||
 | 
					          dst: |
 | 
				
			||||||
 | 
					            quay.io/user/app:latest
 | 
				
			||||||
 | 
					            quay.io/user/app:1.0.0
 | 
				
			||||||
 | 
					            ghcr.io/user/app:latest
 | 
				
			||||||
 | 
					            ghcr.io/user/app:1.0.0
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										48
									
								
								docs/advanced/dockerhub-desc.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								docs/advanced/dockerhub-desc.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					# Update DockerHub repo description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can update the [DockerHub repository description](https://docs.docker.com/docker-hub/repos/) using
 | 
				
			||||||
 | 
					a third party action called [DockerHub Description](https://github.com/peter-evans/dockerhub-description)
 | 
				
			||||||
 | 
					with this action:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Update repo description
 | 
				
			||||||
 | 
					        uses: peter-evans/dockerhub-description@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_PASSWORD }}
 | 
				
			||||||
 | 
					          repository: user/app
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										35
									
								
								docs/advanced/export-docker.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								docs/advanced/export-docker.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					# Export image to Docker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You may want your build result to be available in the Docker client through `docker images` to be able to use it
 | 
				
			||||||
 | 
					in another step of your workflow:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          load: true
 | 
				
			||||||
 | 
					          tags: myimage:latest
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Inspect
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker image inspect myimage:latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										44
									
								
								docs/advanced/isolated-builders.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								docs/advanced/isolated-builders.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					# Isolated builders
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					        id: builder1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					        id: builder2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Builder 1 name
 | 
				
			||||||
 | 
					        run: echo ${{ steps.builder1.outputs.name }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Builder 2 name
 | 
				
			||||||
 | 
					        run: echo ${{ steps.builder2.outputs.name }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build against builder1
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          builder: ${{ steps.builder1.outputs.name }}
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          target: mytarget1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build against builder2
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          builder: ${{ steps.builder2.outputs.name }}
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          target: mytarget2
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										44
									
								
								docs/advanced/local-registry.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								docs/advanced/local-registry.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					# Local registry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    services:
 | 
				
			||||||
 | 
					      registry:
 | 
				
			||||||
 | 
					        image: registry:2
 | 
				
			||||||
 | 
					        ports:
 | 
				
			||||||
 | 
					          - 5000:5000
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          driver-opts: network=host
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push to local registry
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: localhost:5000/name/app:latest
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Inspect
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker buildx imagetools inspect localhost:5000/name/app:latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										44
									
								
								docs/advanced/multi-platform.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								docs/advanced/multi-platform.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					# Multi-platform image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can build multi-platform images using the [`platforms` input](../../README.md#inputs) as described below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :bulb: List of available platforms will be displayed and available through our [setup-buildx](https://github.com/docker/setup-buildx-action#about) action.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :bulb: If you want support for more platforms, you can use QEMU with our [setup-qemu](https://github.com/docker/setup-qemu-action) action.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										57
									
								
								docs/advanced/push-multi-registries.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								docs/advanced/push-multi-registries.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,57 @@
 | 
				
			|||||||
 | 
					# Push to multi-registries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* [Docker Hub and GHCR](#docker-hub-and-ghcr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Docker Hub and GHCR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The following workflow will connect you to [DockerHub](https://github.com/docker/login-action#dockerhub)
 | 
				
			||||||
 | 
					and [GitHub Container Registry](https://github.com/docker/login-action#github-container-registry) and push the
 | 
				
			||||||
 | 
					image to these registries.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to GitHub Container Registry
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          registry: ghcr.io
 | 
				
			||||||
 | 
					          username: ${{ github.repository_owner }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            user/app:latest
 | 
				
			||||||
 | 
					            user/app:1.0.0
 | 
				
			||||||
 | 
					            ghcr.io/user/app:latest
 | 
				
			||||||
 | 
					            ghcr.io/user/app:1.0.0
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										84
									
								
								docs/advanced/secrets.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								docs/advanced/secrets.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,84 @@
 | 
				
			|||||||
 | 
					# Secrets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In the following example we will expose and use the [GITHUB_TOKEN secret](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret)
 | 
				
			||||||
 | 
					as provided by GitHub in your workflow.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					First let's create our `Dockerfile` to use our secret:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```Dockerfile
 | 
				
			||||||
 | 
					#syntax=docker/dockerfile:1.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM alpine
 | 
				
			||||||
 | 
					RUN --mount=type=secret,id=github_token \
 | 
				
			||||||
 | 
					  cat /run/secrets/github_token
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					As you can see we have named our secret `github_token`. Here is the workflow you can use to expose this secret using
 | 
				
			||||||
 | 
					the [`secrets` input](../../README.md#inputs):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					          secrets: |
 | 
				
			||||||
 | 
					            "github_token=${{ secrets.GITHUB_TOKEN }}"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :bulb: You can also expose a secret file to the build with [`secret-files`](../../README.md#inputs) input:
 | 
				
			||||||
 | 
					> ```yaml
 | 
				
			||||||
 | 
					> secret-files: |
 | 
				
			||||||
 | 
					>   "MY_SECRET=./secret.txt"
 | 
				
			||||||
 | 
					> ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you're using [GitHub secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) and need to handle
 | 
				
			||||||
 | 
					multi-line value, you will need to place the key-value pair between quotes:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					secrets: |
 | 
				
			||||||
 | 
					  "MYSECRET=${{ secrets.GPG_KEY }}"
 | 
				
			||||||
 | 
					  GIT_AUTH_TOKEN=abcdefghi,jklmno=0123456789
 | 
				
			||||||
 | 
					  "MYSECRET=aaaaaaaa
 | 
				
			||||||
 | 
					  bbbbbbb
 | 
				
			||||||
 | 
					  ccccccccc"
 | 
				
			||||||
 | 
					  FOO=bar
 | 
				
			||||||
 | 
					  "EMPTYLINE=aaaa
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  bbbb
 | 
				
			||||||
 | 
					  ccc"
 | 
				
			||||||
 | 
					  "JSON_SECRET={""key1"":""value1"",""key2"":""value2""}"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| Key                | Value                                            |
 | 
				
			||||||
 | 
					|--------------------|--------------------------------------------------|
 | 
				
			||||||
 | 
					| `MYSECRET`         | `***********************` |
 | 
				
			||||||
 | 
					| `GIT_AUTH_TOKEN`   | `abcdefghi,jklmno=0123456789` |
 | 
				
			||||||
 | 
					| `MYSECRET`         | `aaaaaaaa\nbbbbbbb\nccccccccc` |
 | 
				
			||||||
 | 
					| `FOO`              | `bar` |
 | 
				
			||||||
 | 
					| `EMPTYLINE`        | `aaaa\n\nbbbb\nccc` |
 | 
				
			||||||
 | 
					| `JSON_SECRET`      | `{"key1":"value1","key2":"value2"}` |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :bulb: All quote signs need to be doubled for escaping.
 | 
				
			||||||
							
								
								
									
										58
									
								
								docs/advanced/share-image-jobs.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								docs/advanced/share-image-jobs.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					# Share built image between jobs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					As each job is isolated in its own runner you cannot use your built image between jobs (except for [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners)).
 | 
				
			||||||
 | 
					However, you can [pass data between jobs in a workflow](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow)
 | 
				
			||||||
 | 
					using the [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact)
 | 
				
			||||||
 | 
					actions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  build:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and export
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          tags: myimage:latest
 | 
				
			||||||
 | 
					          outputs: type=docker,dest=/tmp/myimage.tar
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Upload artifact
 | 
				
			||||||
 | 
					        uses: actions/upload-artifact@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          name: myimage
 | 
				
			||||||
 | 
					          path: /tmp/myimage.tar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  use:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    needs: build
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Download artifact
 | 
				
			||||||
 | 
					        uses: actions/download-artifact@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          name: myimage
 | 
				
			||||||
 | 
					          path: /tmp
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Load image
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker load --input /tmp/myimage.tar
 | 
				
			||||||
 | 
					          docker image ls -a
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										76
									
								
								docs/advanced/tags-labels.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								docs/advanced/tags-labels.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,76 @@
 | 
				
			|||||||
 | 
					# Handle tags and labels
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you want an "automatic" tag management and [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
 | 
				
			||||||
 | 
					for labels, you can do it in a dedicated step. The following workflow will use the [Docker metadata action](https://github.com/docker/metadata-action)
 | 
				
			||||||
 | 
					to handle tags and labels based on GitHub actions events and Git metadata.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  schedule:
 | 
				
			||||||
 | 
					    - cron: '0 10 * * *'
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - '**'
 | 
				
			||||||
 | 
					    tags:
 | 
				
			||||||
 | 
					      - 'v*.*.*'
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker meta
 | 
				
			||||||
 | 
					        id: meta
 | 
				
			||||||
 | 
					        uses: docker/metadata-action@v3
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          # list of Docker images to use as base name for tags
 | 
				
			||||||
 | 
					          images: |
 | 
				
			||||||
 | 
					            name/app
 | 
				
			||||||
 | 
					            ghcr.io/username/app
 | 
				
			||||||
 | 
					          # generate Docker tags based on the following events/attributes
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            type=schedule
 | 
				
			||||||
 | 
					            type=ref,event=branch
 | 
				
			||||||
 | 
					            type=ref,event=pr
 | 
				
			||||||
 | 
					            type=semver,pattern={{version}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}.{{minor}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}
 | 
				
			||||||
 | 
					            type=sha
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1 
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to GHCR
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          registry: ghcr.io
 | 
				
			||||||
 | 
					          username: ${{ github.repository_owner }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					          tags: ${{ steps.meta.outputs.tags }}
 | 
				
			||||||
 | 
					          labels: ${{ steps.meta.outputs.labels }}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
							
								
								
									
										64
									
								
								docs/advanced/test-before-push.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								docs/advanced/test-before-push.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					# Test your image before pushing it
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In some cases, you might want to validate that the image works as expected
 | 
				
			||||||
 | 
					before pushing it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The workflow below will be composed of several steps to achieve this:
 | 
				
			||||||
 | 
					* Build and export the image to Docker
 | 
				
			||||||
 | 
					* Test your image
 | 
				
			||||||
 | 
					* Multi-platform build and push the image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  TEST_TAG: user/myapp:test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up QEMU
 | 
				
			||||||
 | 
					        uses: docker/setup-qemu-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and export to Docker
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          load: true
 | 
				
			||||||
 | 
					          tags: ${{ env.TEST_TAG }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Test
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          docker run --rm ${{ env.TEST_TAG }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          push: true
 | 
				
			||||||
 | 
					          tags: user/app:latest
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					> :bulb: Build time will not be increased with this workflow because internal
 | 
				
			||||||
 | 
					> cache for `linux/amd64` will be used from previous step on `Build and push`
 | 
				
			||||||
 | 
					> step so only `linux/arm64` will be actually built.
 | 
				
			||||||
@ -1,20 +1,15 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					# syntax=docker/dockerfile:1.3-labs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARG NODE_VERSION=20
 | 
					ARG NODE_VERSION
 | 
				
			||||||
 | 
					ARG DOCKER_VERSION=20.10.10
 | 
				
			||||||
 | 
					ARG BUILDX_VERSION=0.7.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM node:${NODE_VERSION}-alpine AS base
 | 
					FROM node:${NODE_VERSION}-alpine AS base
 | 
				
			||||||
RUN apk add --no-cache cpio findutils git
 | 
					RUN apk add --no-cache cpio findutils git
 | 
				
			||||||
WORKDIR /src
 | 
					WORKDIR /src
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache <<EOT
 | 
					 | 
				
			||||||
  corepack enable
 | 
					 | 
				
			||||||
  yarn --version
 | 
					 | 
				
			||||||
  yarn config set --home enableTelemetry 0
 | 
					 | 
				
			||||||
EOT
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM base AS deps
 | 
					FROM base AS deps
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					RUN --mount=type=bind,target=.,rw \
 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/node_modules \
 | 
					  --mount=type=cache,target=/src/node_modules \
 | 
				
			||||||
  yarn install && mkdir /vendor && cp yarn.lock /vendor
 | 
					  yarn install && mkdir /vendor && cp yarn.lock /vendor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,7 +30,6 @@ EOT
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
FROM deps AS build
 | 
					FROM deps AS build
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					RUN --mount=type=bind,target=.,rw \
 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/node_modules \
 | 
					  --mount=type=cache,target=/src/node_modules \
 | 
				
			||||||
  yarn run build && mkdir /out && cp -Rf dist /out/
 | 
					  yarn run build && mkdir /out && cp -Rf dist /out/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -56,25 +50,29 @@ EOT
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
FROM deps AS format
 | 
					FROM deps AS format
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					RUN --mount=type=bind,target=.,rw \
 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/node_modules \
 | 
					  --mount=type=cache,target=/src/node_modules \
 | 
				
			||||||
  yarn run format \
 | 
					  yarn run format \
 | 
				
			||||||
  && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
 | 
					  && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM scratch AS format-update
 | 
					FROM scratch AS format-update
 | 
				
			||||||
COPY --from=format /out /
 | 
					COPY --from=format /out /
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM deps AS lint
 | 
					FROM deps AS format-validate
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					RUN --mount=type=bind,target=.,rw \
 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/node_modules \
 | 
					  --mount=type=cache,target=/src/node_modules \
 | 
				
			||||||
  yarn run lint
 | 
					  yarn run format-check
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FROM docker:${DOCKER_VERSION} as docker
 | 
				
			||||||
 | 
					FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM deps AS test
 | 
					FROM deps AS test
 | 
				
			||||||
 | 
					ENV RUNNER_TEMP=/tmp/github_runner
 | 
				
			||||||
 | 
					ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
 | 
				
			||||||
RUN --mount=type=bind,target=.,rw \
 | 
					RUN --mount=type=bind,target=.,rw \
 | 
				
			||||||
  --mount=type=cache,target=/src/.yarn/cache \
 | 
					 | 
				
			||||||
  --mount=type=cache,target=/src/node_modules \
 | 
					  --mount=type=cache,target=/src/node_modules \
 | 
				
			||||||
  yarn run test --coverage --coverageDirectory=/tmp/coverage
 | 
					  --mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
 | 
				
			||||||
 | 
					  --mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
 | 
				
			||||||
 | 
					  yarn run test --coverageDirectory=/tmp/coverage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM scratch AS test-coverage
 | 
					FROM scratch AS test-coverage
 | 
				
			||||||
COPY --from=test /tmp/coverage /
 | 
					COPY --from=test /tmp/coverage /
 | 
				
			||||||
							
								
								
									
										12
									
								
								jest.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								jest.config.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
					  clearMocks: false,
 | 
				
			||||||
 | 
					  moduleFileExtensions: ['js', 'ts'],
 | 
				
			||||||
 | 
					  setupFiles: ["dotenv/config"],
 | 
				
			||||||
 | 
					  testEnvironment: 'node',
 | 
				
			||||||
 | 
					  testMatch: ['**/*.test.ts'],
 | 
				
			||||||
 | 
					  testRunner: 'jest-circus/runner',
 | 
				
			||||||
 | 
					  transform: {
 | 
				
			||||||
 | 
					    '^.+\\.ts$': 'ts-jest'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  verbose: false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,30 +0,0 @@
 | 
				
			|||||||
import fs from 'fs';
 | 
					 | 
				
			||||||
import os from 'os';
 | 
					 | 
				
			||||||
import path from 'path';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-build-push-action-'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
process.env = Object.assign({}, process.env, {
 | 
					 | 
				
			||||||
  TEMP: tmpDir,
 | 
					 | 
				
			||||||
  GITHUB_REPOSITORY: 'docker/build-push-action',
 | 
					 | 
				
			||||||
  RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
 | 
					 | 
				
			||||||
  RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
 | 
					 | 
				
			||||||
}) as {
 | 
					 | 
				
			||||||
  [key: string]: string;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = {
 | 
					 | 
				
			||||||
  clearMocks: false,
 | 
					 | 
				
			||||||
  testEnvironment: 'node',
 | 
					 | 
				
			||||||
  moduleFileExtensions: ['js', 'ts'],
 | 
					 | 
				
			||||||
  testMatch: ['**/*.test.ts'],
 | 
					 | 
				
			||||||
  transform: {
 | 
					 | 
				
			||||||
    '^.+\\.ts$': 'ts-jest'
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  moduleNameMapper: {
 | 
					 | 
				
			||||||
    '^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
 | 
					 | 
				
			||||||
  coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
 | 
					 | 
				
			||||||
  verbose: true
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
							
								
								
									
										60
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								package.json
									
									
									
									
									
								
							@ -1,16 +1,13 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "docker-build-push",
 | 
					  "name": "docker-build-push",
 | 
				
			||||||
  "description": "Build and push Docker images",
 | 
					  "description": "Build and push Docker images",
 | 
				
			||||||
  "main": "src/main.ts",
 | 
					  "main": "lib/main.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build": "ncc build --source-map --minify --license licenses.txt",
 | 
					    "build": "tsc && ncc build",
 | 
				
			||||||
    "lint": "yarn run prettier && yarn run eslint",
 | 
					    "format": "prettier --write **/*.ts",
 | 
				
			||||||
    "format": "yarn run prettier:fix && yarn run eslint:fix",
 | 
					    "format-check": "prettier --check **/*.ts",
 | 
				
			||||||
    "eslint": "eslint --max-warnings=0 .",
 | 
					    "test": "jest --coverage",
 | 
				
			||||||
    "eslint:fix": "eslint --fix .",
 | 
					    "pre-checkin": "yarn run format && yarn run build"
 | 
				
			||||||
    "prettier": "prettier --check \"./**/*.ts\"",
 | 
					 | 
				
			||||||
    "prettier:fix": "prettier --write \"./**/*.ts\"",
 | 
					 | 
				
			||||||
    "test": "jest"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
@ -22,27 +19,36 @@
 | 
				
			|||||||
    "build",
 | 
					    "build",
 | 
				
			||||||
    "push"
 | 
					    "push"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "author": "Docker Inc.",
 | 
					  "author": "Docker",
 | 
				
			||||||
 | 
					  "contributors": [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      "name": "CrazyMax",
 | 
				
			||||||
 | 
					      "url": "https://crazymax.dev"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "packageManager": "yarn@3.6.3",
 | 
					 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@actions/core": "^1.11.1",
 | 
					    "@actions/core": "^1.6.0",
 | 
				
			||||||
    "@docker/actions-toolkit": "0.59.0",
 | 
					    "@actions/exec": "^1.1.0",
 | 
				
			||||||
    "handlebars": "^4.7.7"
 | 
					    "@actions/github": "^5.0.0",
 | 
				
			||||||
 | 
					    "csv-parse": "^4.16.3",
 | 
				
			||||||
 | 
					    "handlebars": "^4.7.7",
 | 
				
			||||||
 | 
					    "semver": "^7.3.5",
 | 
				
			||||||
 | 
					    "tmp": "^0.2.1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@types/node": "^20.12.12",
 | 
					    "@types/csv-parse": "^1.2.2",
 | 
				
			||||||
    "@typescript-eslint/eslint-plugin": "^7.9.0",
 | 
					    "@types/jest": "^26.0.23",
 | 
				
			||||||
    "@typescript-eslint/parser": "^7.9.0",
 | 
					    "@types/node": "^14.17.4",
 | 
				
			||||||
    "@vercel/ncc": "^0.38.1",
 | 
					    "@types/tmp": "^0.2.0",
 | 
				
			||||||
    "eslint": "^8.57.0",
 | 
					    "@vercel/ncc": "^0.28.6",
 | 
				
			||||||
    "eslint-config-prettier": "^9.1.0",
 | 
					    "dotenv": "^8.6.0",
 | 
				
			||||||
    "eslint-plugin-jest": "^28.5.0",
 | 
					    "jest": "^26.6.3",
 | 
				
			||||||
    "eslint-plugin-prettier": "^5.1.3",
 | 
					    "jest-circus": "^26.6.3",
 | 
				
			||||||
    "jest": "^29.7.0",
 | 
					    "jest-runtime": "^26.6.3",
 | 
				
			||||||
    "prettier": "^3.2.5",
 | 
					    "prettier": "^2.3.1",
 | 
				
			||||||
    "ts-jest": "^29.1.2",
 | 
					    "ts-jest": "^26.5.6",
 | 
				
			||||||
    "ts-node": "^10.9.2",
 | 
					    "typescript": "^4.3.4",
 | 
				
			||||||
    "typescript": "^5.4.5"
 | 
					    "typescript-formatter": "^7.2.2"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										147
									
								
								src/buildx.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								src/buildx.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,147 @@
 | 
				
			|||||||
 | 
					import csvparse from 'csv-parse/lib/sync';
 | 
				
			||||||
 | 
					import fs from 'fs';
 | 
				
			||||||
 | 
					import path from 'path';
 | 
				
			||||||
 | 
					import * as semver from 'semver';
 | 
				
			||||||
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import * as context from './context';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getImageIDFile(): Promise<string> {
 | 
				
			||||||
 | 
					  return path.join(context.tmpDir(), 'iidfile').split(path.sep).join(path.posix.sep);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getImageID(): Promise<string | undefined> {
 | 
				
			||||||
 | 
					  const iidFile = await getImageIDFile();
 | 
				
			||||||
 | 
					  if (!fs.existsSync(iidFile)) {
 | 
				
			||||||
 | 
					    return undefined;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return fs.readFileSync(iidFile, {encoding: 'utf-8'}).trim();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getMetadataFile(): Promise<string> {
 | 
				
			||||||
 | 
					  return path.join(context.tmpDir(), 'metadata-file').split(path.sep).join(path.posix.sep);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getMetadata(): Promise<string | undefined> {
 | 
				
			||||||
 | 
					  const metadataFile = await getMetadataFile();
 | 
				
			||||||
 | 
					  if (!fs.existsSync(metadataFile)) {
 | 
				
			||||||
 | 
					    return undefined;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  const content = fs.readFileSync(metadataFile, {encoding: 'utf-8'}).trim();
 | 
				
			||||||
 | 
					  if (content === 'null') {
 | 
				
			||||||
 | 
					    return undefined;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return content;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getDigest(metadata: string | undefined): Promise<string | undefined> {
 | 
				
			||||||
 | 
					  if (metadata === undefined) {
 | 
				
			||||||
 | 
					    return undefined;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  const metadataJSON = JSON.parse(metadata);
 | 
				
			||||||
 | 
					  if (metadataJSON['containerimage.digest']) {
 | 
				
			||||||
 | 
					    return metadataJSON['containerimage.digest'];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return undefined;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getSecretString(kvp: string): Promise<string> {
 | 
				
			||||||
 | 
					  return getSecret(kvp, false);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getSecretFile(kvp: string): Promise<string> {
 | 
				
			||||||
 | 
					  return getSecret(kvp, true);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getSecret(kvp: string, file: boolean): Promise<string> {
 | 
				
			||||||
 | 
					  const delimiterIndex = kvp.indexOf('=');
 | 
				
			||||||
 | 
					  const key = kvp.substring(0, delimiterIndex);
 | 
				
			||||||
 | 
					  let value = kvp.substring(delimiterIndex + 1);
 | 
				
			||||||
 | 
					  if (key.length == 0 || value.length == 0) {
 | 
				
			||||||
 | 
					    throw new Error(`${kvp} is not a valid secret`);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (file) {
 | 
				
			||||||
 | 
					    if (!fs.existsSync(value)) {
 | 
				
			||||||
 | 
					      throw new Error(`secret file ${value} not found`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    value = fs.readFileSync(value, {encoding: 'utf-8'});
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const secretFile = context.tmpNameSync({
 | 
				
			||||||
 | 
					    tmpdir: context.tmpDir()
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					  fs.writeFileSync(secretFile, value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return `id=${key},src=${secretFile}`;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function isLocalOrTarExporter(outputs: string[]): Boolean {
 | 
				
			||||||
 | 
					  for (let output of csvparse(outputs.join(`\n`), {
 | 
				
			||||||
 | 
					    delimiter: ',',
 | 
				
			||||||
 | 
					    trim: true,
 | 
				
			||||||
 | 
					    columns: false,
 | 
				
			||||||
 | 
					    relaxColumnCount: true
 | 
				
			||||||
 | 
					  })) {
 | 
				
			||||||
 | 
					    // Local if no type is defined
 | 
				
			||||||
 | 
					    // https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43
 | 
				
			||||||
 | 
					    if (output.length == 1 && !output[0].startsWith('type=')) {
 | 
				
			||||||
 | 
					      return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    for (let [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) {
 | 
				
			||||||
 | 
					      if (key == 'type' && (value == 'local' || value == 'tar')) {
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function hasGitAuthToken(secrets: string[]): Boolean {
 | 
				
			||||||
 | 
					  for (let secret of secrets) {
 | 
				
			||||||
 | 
					    if (secret.startsWith('GIT_AUTH_TOKEN=')) {
 | 
				
			||||||
 | 
					      return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function isAvailable(): Promise<Boolean> {
 | 
				
			||||||
 | 
					  return await exec
 | 
				
			||||||
 | 
					    .getExecOutput('docker', ['buildx'], {
 | 
				
			||||||
 | 
					      ignoreReturnCode: true,
 | 
				
			||||||
 | 
					      silent: true
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .then(res => {
 | 
				
			||||||
 | 
					      if (res.stderr.length > 0 && res.exitCode != 0) {
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return res.exitCode == 0;
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getVersion(): Promise<string> {
 | 
				
			||||||
 | 
					  return await exec
 | 
				
			||||||
 | 
					    .getExecOutput('docker', ['buildx', 'version'], {
 | 
				
			||||||
 | 
					      ignoreReturnCode: true,
 | 
				
			||||||
 | 
					      silent: true
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    .then(res => {
 | 
				
			||||||
 | 
					      if (res.stderr.length > 0 && res.exitCode != 0) {
 | 
				
			||||||
 | 
					        throw new Error(res.stderr.trim());
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return parseVersion(res.stdout.trim());
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function parseVersion(stdout: string): string {
 | 
				
			||||||
 | 
					  const matches = /\sv?([0-9a-f]{7}|[0-9.]+)/.exec(stdout);
 | 
				
			||||||
 | 
					  if (!matches) {
 | 
				
			||||||
 | 
					    throw new Error(`Cannot parse buildx version`);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return matches[1];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function satisfies(version: string, range: string): boolean {
 | 
				
			||||||
 | 
					  return semver.satisfies(version, range) || /^[0-9a-f]{7}$/.exec(version) !== null;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										308
									
								
								src/context.ts
									
									
									
									
									
								
							
							
						
						
									
										308
									
								
								src/context.ts
									
									
									
									
									
								
							@ -1,223 +1,201 @@
 | 
				
			|||||||
 | 
					import csvparse from 'csv-parse/lib/sync';
 | 
				
			||||||
 | 
					import * as fs from 'fs';
 | 
				
			||||||
 | 
					import * as os from 'os';
 | 
				
			||||||
 | 
					import * as path from 'path';
 | 
				
			||||||
 | 
					import * as tmp from 'tmp';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
 | 
					import {issueCommand} from '@actions/core/lib/command';
 | 
				
			||||||
 | 
					import * as github from '@actions/github';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import * as buildx from './buildx';
 | 
				
			||||||
import * as handlebars from 'handlebars';
 | 
					import * as handlebars from 'handlebars';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
 | 
					let _defaultContext, _tmpDir: string;
 | 
				
			||||||
import {Context} from '@docker/actions-toolkit/lib/context';
 | 
					 | 
				
			||||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
 | 
					 | 
				
			||||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
 | 
					 | 
				
			||||||
import {Util} from '@docker/actions-toolkit/lib/util';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Inputs {
 | 
					export interface Inputs {
 | 
				
			||||||
  'add-hosts': string[];
 | 
					  addHosts: string[];
 | 
				
			||||||
  allow: string[];
 | 
					  allow: string[];
 | 
				
			||||||
  annotations: string[];
 | 
					  buildArgs: string[];
 | 
				
			||||||
  attests: string[];
 | 
					  buildContexts: string[];
 | 
				
			||||||
  'build-args': string[];
 | 
					 | 
				
			||||||
  'build-contexts': string[];
 | 
					 | 
				
			||||||
  builder: string;
 | 
					  builder: string;
 | 
				
			||||||
  'cache-from': string[];
 | 
					  cacheFrom: string[];
 | 
				
			||||||
  'cache-to': string[];
 | 
					  cacheTo: string[];
 | 
				
			||||||
  call: string;
 | 
					  cgroupParent: string;
 | 
				
			||||||
  'cgroup-parent': string;
 | 
					 | 
				
			||||||
  context: string;
 | 
					  context: string;
 | 
				
			||||||
  file: string;
 | 
					  file: string;
 | 
				
			||||||
  labels: string[];
 | 
					  labels: string[];
 | 
				
			||||||
  load: boolean;
 | 
					  load: boolean;
 | 
				
			||||||
  network: string;
 | 
					  network: string;
 | 
				
			||||||
  'no-cache': boolean;
 | 
					  noCache: boolean;
 | 
				
			||||||
  'no-cache-filters': string[];
 | 
					 | 
				
			||||||
  outputs: string[];
 | 
					  outputs: string[];
 | 
				
			||||||
  platforms: string[];
 | 
					  platforms: string[];
 | 
				
			||||||
  provenance: string;
 | 
					 | 
				
			||||||
  pull: boolean;
 | 
					  pull: boolean;
 | 
				
			||||||
  push: boolean;
 | 
					  push: boolean;
 | 
				
			||||||
  sbom: string;
 | 
					 | 
				
			||||||
  secrets: string[];
 | 
					  secrets: string[];
 | 
				
			||||||
  'secret-envs': string[];
 | 
					  secretFiles: string[];
 | 
				
			||||||
  'secret-files': string[];
 | 
					  shmSize: string;
 | 
				
			||||||
  'shm-size': string;
 | 
					 | 
				
			||||||
  ssh: string[];
 | 
					  ssh: string[];
 | 
				
			||||||
  tags: string[];
 | 
					  tags: string[];
 | 
				
			||||||
  target: string;
 | 
					  target: string;
 | 
				
			||||||
  ulimit: string[];
 | 
					  ulimit: string[];
 | 
				
			||||||
  'github-token': string;
 | 
					  githubToken: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function getInputs(): Promise<Inputs> {
 | 
					export function defaultContext(): string {
 | 
				
			||||||
 | 
					  if (!_defaultContext) {
 | 
				
			||||||
 | 
					    let ref = github.context.ref;
 | 
				
			||||||
 | 
					    if (github.context.sha && ref && !ref.startsWith('refs/')) {
 | 
				
			||||||
 | 
					      ref = `refs/heads/${github.context.ref}`;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (github.context.sha && !ref.startsWith(`refs/pull/`)) {
 | 
				
			||||||
 | 
					      ref = github.context.sha;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    _defaultContext = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${github.context.repo.repo}.git#${ref}`;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return _defaultContext;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function tmpDir(): string {
 | 
				
			||||||
 | 
					  if (!_tmpDir) {
 | 
				
			||||||
 | 
					    _tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-build-push-')).split(path.sep).join(path.posix.sep);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return _tmpDir;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function tmpNameSync(options?: tmp.TmpNameOptions): string {
 | 
				
			||||||
 | 
					  return tmp.tmpNameSync(options);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export async function getInputs(defaultContext: string): Promise<Inputs> {
 | 
				
			||||||
  return {
 | 
					  return {
 | 
				
			||||||
    'add-hosts': Util.getInputList('add-hosts'),
 | 
					    addHosts: await getInputList('add-hosts'),
 | 
				
			||||||
    allow: Util.getInputList('allow'),
 | 
					    allow: await getInputList('allow'),
 | 
				
			||||||
    annotations: Util.getInputList('annotations', {ignoreComma: true}),
 | 
					    buildArgs: await getInputList('build-args', true),
 | 
				
			||||||
    attests: Util.getInputList('attests', {ignoreComma: true}),
 | 
					    buildContexts: await getInputList('build-contexts', true),
 | 
				
			||||||
    'build-args': Util.getInputList('build-args', {ignoreComma: true}),
 | 
					 | 
				
			||||||
    'build-contexts': Util.getInputList('build-contexts', {ignoreComma: true}),
 | 
					 | 
				
			||||||
    builder: core.getInput('builder'),
 | 
					    builder: core.getInput('builder'),
 | 
				
			||||||
    'cache-from': Util.getInputList('cache-from', {ignoreComma: true}),
 | 
					    cacheFrom: await getInputList('cache-from', true),
 | 
				
			||||||
    'cache-to': Util.getInputList('cache-to', {ignoreComma: true}),
 | 
					    cacheTo: await getInputList('cache-to', true),
 | 
				
			||||||
    call: core.getInput('call'),
 | 
					    cgroupParent: core.getInput('cgroup-parent'),
 | 
				
			||||||
    'cgroup-parent': core.getInput('cgroup-parent'),
 | 
					    context: core.getInput('context') || defaultContext,
 | 
				
			||||||
    context: core.getInput('context') || Context.gitContext(),
 | 
					 | 
				
			||||||
    file: core.getInput('file'),
 | 
					    file: core.getInput('file'),
 | 
				
			||||||
    labels: Util.getInputList('labels', {ignoreComma: true}),
 | 
					    labels: await getInputList('labels', true),
 | 
				
			||||||
    load: core.getBooleanInput('load'),
 | 
					    load: core.getBooleanInput('load'),
 | 
				
			||||||
    network: core.getInput('network'),
 | 
					    network: core.getInput('network'),
 | 
				
			||||||
    'no-cache': core.getBooleanInput('no-cache'),
 | 
					    noCache: core.getBooleanInput('no-cache'),
 | 
				
			||||||
    'no-cache-filters': Util.getInputList('no-cache-filters'),
 | 
					    outputs: await getInputList('outputs', true),
 | 
				
			||||||
    outputs: Util.getInputList('outputs', {ignoreComma: true, quote: false}),
 | 
					    platforms: await getInputList('platforms'),
 | 
				
			||||||
    platforms: Util.getInputList('platforms'),
 | 
					 | 
				
			||||||
    provenance: Build.getProvenanceInput('provenance'),
 | 
					 | 
				
			||||||
    pull: core.getBooleanInput('pull'),
 | 
					    pull: core.getBooleanInput('pull'),
 | 
				
			||||||
    push: core.getBooleanInput('push'),
 | 
					    push: core.getBooleanInput('push'),
 | 
				
			||||||
    sbom: core.getInput('sbom'),
 | 
					    secrets: await getInputList('secrets', true),
 | 
				
			||||||
    secrets: Util.getInputList('secrets', {ignoreComma: true}),
 | 
					    secretFiles: await getInputList('secret-files', true),
 | 
				
			||||||
    'secret-envs': Util.getInputList('secret-envs'),
 | 
					    shmSize: core.getInput('shm-size'),
 | 
				
			||||||
    'secret-files': Util.getInputList('secret-files', {ignoreComma: true}),
 | 
					    ssh: await getInputList('ssh'),
 | 
				
			||||||
    'shm-size': core.getInput('shm-size'),
 | 
					    tags: await getInputList('tags'),
 | 
				
			||||||
    ssh: Util.getInputList('ssh'),
 | 
					 | 
				
			||||||
    tags: Util.getInputList('tags'),
 | 
					 | 
				
			||||||
    target: core.getInput('target'),
 | 
					    target: core.getInput('target'),
 | 
				
			||||||
    ulimit: Util.getInputList('ulimit', {ignoreComma: true}),
 | 
					    ulimit: await getInputList('ulimit', true),
 | 
				
			||||||
    'github-token': core.getInput('github-token')
 | 
					    githubToken: core.getInput('github-token')
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function getArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
 | 
					export async function getArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
 | 
				
			||||||
  const context = handlebars.compile(inputs.context)({
 | 
					  let args: Array<string> = ['buildx'];
 | 
				
			||||||
    defaultContext: Context.gitContext()
 | 
					  args.push.apply(args, await getBuildArgs(inputs, defaultContext, buildxVersion));
 | 
				
			||||||
  });
 | 
					  args.push.apply(args, await getCommonArgs(inputs, buildxVersion));
 | 
				
			||||||
  // prettier-ignore
 | 
					  args.push(handlebars.compile(inputs.context)({defaultContext}));
 | 
				
			||||||
  return [
 | 
					  return args;
 | 
				
			||||||
    ...await getBuildArgs(inputs, context, toolkit),
 | 
					 | 
				
			||||||
    ...await getCommonArgs(inputs, toolkit),
 | 
					 | 
				
			||||||
    context
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit): Promise<Array<string>> {
 | 
					async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersion: string): Promise<Array<string>> {
 | 
				
			||||||
  const args: Array<string> = ['build'];
 | 
					  let args: Array<string> = ['build'];
 | 
				
			||||||
  await Util.asyncForEach(inputs['add-hosts'], async addHost => {
 | 
					  await asyncForEach(inputs.addHosts, async addHost => {
 | 
				
			||||||
    args.push('--add-host', addHost);
 | 
					    args.push('--add-host', addHost);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  await Util.asyncForEach(inputs.allow, async allow => {
 | 
					  if (inputs.allow.length > 0) {
 | 
				
			||||||
    args.push('--allow', allow);
 | 
					    args.push('--allow', inputs.allow.join(','));
 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
  if (await toolkit.buildx.versionSatisfies('>=0.12.0')) {
 | 
					 | 
				
			||||||
    await Util.asyncForEach(inputs.annotations, async annotation => {
 | 
					 | 
				
			||||||
      args.push('--annotation', annotation);
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  } else if (inputs.annotations.length > 0) {
 | 
					 | 
				
			||||||
    core.warning("Annotations are only supported by buildx >= 0.12.0; the input 'annotations' is ignored.");
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  await Util.asyncForEach(inputs['build-args'], async buildArg => {
 | 
					  await asyncForEach(inputs.buildArgs, async buildArg => {
 | 
				
			||||||
    args.push('--build-arg', buildArg);
 | 
					    args.push('--build-arg', buildArg);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  if (await toolkit.buildx.versionSatisfies('>=0.8.0')) {
 | 
					  if (buildx.satisfies(buildxVersion, '>=0.8.0')) {
 | 
				
			||||||
    await Util.asyncForEach(inputs['build-contexts'], async buildContext => {
 | 
					    await asyncForEach(inputs.buildContexts, async buildContext => {
 | 
				
			||||||
      args.push(
 | 
					      args.push('--build-context', buildContext);
 | 
				
			||||||
        '--build-context',
 | 
					 | 
				
			||||||
        handlebars.compile(buildContext)({
 | 
					 | 
				
			||||||
          defaultContext: Context.gitContext()
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  } else if (inputs['build-contexts'].length > 0) {
 | 
					 | 
				
			||||||
    core.warning("Build contexts are only supported by buildx >= 0.8.0; the input 'build-contexts' is ignored.");
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  await Util.asyncForEach(inputs['cache-from'], async cacheFrom => {
 | 
					  await asyncForEach(inputs.cacheFrom, async cacheFrom => {
 | 
				
			||||||
    args.push('--cache-from', cacheFrom);
 | 
					    args.push('--cache-from', cacheFrom);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  await Util.asyncForEach(inputs['cache-to'], async cacheTo => {
 | 
					  await asyncForEach(inputs.cacheTo, async cacheTo => {
 | 
				
			||||||
    args.push('--cache-to', cacheTo);
 | 
					    args.push('--cache-to', cacheTo);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  if (inputs.call) {
 | 
					  if (inputs.cgroupParent) {
 | 
				
			||||||
    if (!(await toolkit.buildx.versionSatisfies('>=0.15.0'))) {
 | 
					    args.push('--cgroup-parent', inputs.cgroupParent);
 | 
				
			||||||
      throw new Error(`Buildx >= 0.15.0 is required to use the call flag.`);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    args.push('--call', inputs.call);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (inputs['cgroup-parent']) {
 | 
					 | 
				
			||||||
    args.push('--cgroup-parent', inputs['cgroup-parent']);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  await Util.asyncForEach(inputs['secret-envs'], async secretEnv => {
 | 
					 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
      args.push('--secret', Build.resolveSecretEnv(secretEnv));
 | 
					 | 
				
			||||||
    } catch (err) {
 | 
					 | 
				
			||||||
      core.warning(err.message);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
  if (inputs.file) {
 | 
					  if (inputs.file) {
 | 
				
			||||||
    args.push('--file', inputs.file);
 | 
					    args.push('--file', inputs.file);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (!Build.hasLocalExporter(inputs.outputs) && !Build.hasTarExporter(inputs.outputs) && (inputs.platforms.length == 0 || (await toolkit.buildx.versionSatisfies('>=0.4.2')))) {
 | 
					  if (!buildx.isLocalOrTarExporter(inputs.outputs) && (inputs.platforms.length == 0 || buildx.satisfies(buildxVersion, '>=0.4.2'))) {
 | 
				
			||||||
    args.push('--iidfile', toolkit.buildxBuild.getImageIDFilePath());
 | 
					    args.push('--iidfile', await buildx.getImageIDFile());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  await Util.asyncForEach(inputs.labels, async label => {
 | 
					  await asyncForEach(inputs.labels, async label => {
 | 
				
			||||||
    args.push('--label', label);
 | 
					    args.push('--label', label);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  await Util.asyncForEach(inputs['no-cache-filters'], async noCacheFilter => {
 | 
					  await asyncForEach(inputs.outputs, async output => {
 | 
				
			||||||
    args.push('--no-cache-filter', noCacheFilter);
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
  await Util.asyncForEach(inputs.outputs, async output => {
 | 
					 | 
				
			||||||
    args.push('--output', output);
 | 
					    args.push('--output', output);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  if (inputs.platforms.length > 0) {
 | 
					  if (inputs.platforms.length > 0) {
 | 
				
			||||||
    args.push('--platform', inputs.platforms.join(','));
 | 
					    args.push('--platform', inputs.platforms.join(','));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (await toolkit.buildx.versionSatisfies('>=0.10.0')) {
 | 
					  await asyncForEach(inputs.secrets, async secret => {
 | 
				
			||||||
    args.push(...(await getAttestArgs(inputs, toolkit)));
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    core.warning("Attestations are only supported by buildx >= 0.10.0; the inputs 'attests', 'provenance' and 'sbom' are ignored.");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  await Util.asyncForEach(inputs.secrets, async secret => {
 | 
					 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      args.push('--secret', Build.resolveSecretString(secret));
 | 
					      args.push('--secret', await buildx.getSecretString(secret));
 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (err) {
 | 
				
			||||||
      core.warning(err.message);
 | 
					      core.warning(err.message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  await Util.asyncForEach(inputs['secret-files'], async secretFile => {
 | 
					  await asyncForEach(inputs.secretFiles, async secretFile => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      args.push('--secret', Build.resolveSecretFile(secretFile));
 | 
					      args.push('--secret', await buildx.getSecretFile(secretFile));
 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (err) {
 | 
				
			||||||
      core.warning(err.message);
 | 
					      core.warning(err.message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  if (inputs['github-token'] && !Build.hasGitAuthTokenSecret(inputs.secrets) && context.startsWith(Context.gitContext())) {
 | 
					  if (inputs.githubToken && !buildx.hasGitAuthToken(inputs.secrets) && inputs.context == defaultContext) {
 | 
				
			||||||
    args.push('--secret', Build.resolveSecretString(`GIT_AUTH_TOKEN=${inputs['github-token']}`));
 | 
					    args.push('--secret', await buildx.getSecretString(`GIT_AUTH_TOKEN=${inputs.githubToken}`));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (inputs['shm-size']) {
 | 
					  if (inputs.shmSize) {
 | 
				
			||||||
    args.push('--shm-size', inputs['shm-size']);
 | 
					    args.push('--shm-size', inputs.shmSize);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  await Util.asyncForEach(inputs.ssh, async ssh => {
 | 
					  await asyncForEach(inputs.ssh, async ssh => {
 | 
				
			||||||
    args.push('--ssh', ssh);
 | 
					    args.push('--ssh', ssh);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  await Util.asyncForEach(inputs.tags, async tag => {
 | 
					  await asyncForEach(inputs.tags, async tag => {
 | 
				
			||||||
    args.push('--tag', tag);
 | 
					    args.push('--tag', tag);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  if (inputs.target) {
 | 
					  if (inputs.target) {
 | 
				
			||||||
    args.push('--target', inputs.target);
 | 
					    args.push('--target', inputs.target);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  await Util.asyncForEach(inputs.ulimit, async ulimit => {
 | 
					  await asyncForEach(inputs.ulimit, async ulimit => {
 | 
				
			||||||
    args.push('--ulimit', ulimit);
 | 
					    args.push('--ulimit', ulimit);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  return args;
 | 
					  return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getCommonArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
 | 
					async function getCommonArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
 | 
				
			||||||
  const args: Array<string> = [];
 | 
					  let args: Array<string> = [];
 | 
				
			||||||
  if (inputs.builder) {
 | 
					  if (inputs.builder) {
 | 
				
			||||||
    args.push('--builder', inputs.builder);
 | 
					    args.push('--builder', inputs.builder);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (inputs.load) {
 | 
					  if (inputs.load) {
 | 
				
			||||||
    args.push('--load');
 | 
					    args.push('--load');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (await toolkit.buildx.versionSatisfies('>=0.6.0')) {
 | 
					  if (buildx.satisfies(buildxVersion, '>=0.6.0')) {
 | 
				
			||||||
    args.push('--metadata-file', toolkit.buildxBuild.getMetadataFilePath());
 | 
					    args.push('--metadata-file', await buildx.getMetadataFile());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (inputs.network) {
 | 
					  if (inputs.network) {
 | 
				
			||||||
    args.push('--network', inputs.network);
 | 
					    args.push('--network', inputs.network);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (inputs['no-cache']) {
 | 
					  if (inputs.noCache) {
 | 
				
			||||||
    args.push('--no-cache');
 | 
					    args.push('--no-cache');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (inputs.pull) {
 | 
					  if (inputs.pull) {
 | 
				
			||||||
@ -229,58 +207,40 @@ async function getCommonArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<st
 | 
				
			|||||||
  return args;
 | 
					  return args;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function getAttestArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
 | 
					export async function getInputList(name: string, ignoreComma?: boolean): Promise<string[]> {
 | 
				
			||||||
  const args: Array<string> = [];
 | 
					  let res: Array<string> = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // check if provenance attestation is set in attests input
 | 
					  const items = core.getInput(name);
 | 
				
			||||||
  let hasAttestProvenance = false;
 | 
					  if (items == '') {
 | 
				
			||||||
  await Util.asyncForEach(inputs.attests, async (attest: string) => {
 | 
					    return res;
 | 
				
			||||||
    if (Build.hasAttestationType('provenance', attest)) {
 | 
					 | 
				
			||||||
      hasAttestProvenance = true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  let provenanceSet = false;
 | 
					 | 
				
			||||||
  let sbomSet = false;
 | 
					 | 
				
			||||||
  if (inputs.provenance) {
 | 
					 | 
				
			||||||
    args.push('--attest', Build.resolveAttestationAttrs(`type=provenance,${inputs.provenance}`));
 | 
					 | 
				
			||||||
    provenanceSet = true;
 | 
					 | 
				
			||||||
  } else if (!hasAttestProvenance && !noDefaultAttestations() && (await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !Build.hasDockerExporter(inputs.outputs, inputs.load)) {
 | 
					 | 
				
			||||||
    // if provenance not specified in provenance or attests inputs and BuildKit
 | 
					 | 
				
			||||||
    // version compatible for attestation, set default provenance. Also needs
 | 
					 | 
				
			||||||
    // to make sure user doesn't want to explicitly load the image to docker.
 | 
					 | 
				
			||||||
    if (GitHub.context.payload.repository?.private ?? false) {
 | 
					 | 
				
			||||||
      // if this is a private repository, we set the default provenance
 | 
					 | 
				
			||||||
      // attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
 | 
					 | 
				
			||||||
      args.push('--attest', `type=provenance,${Build.resolveProvenanceAttrs(`mode=min,inline-only=true`)}`);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      // for a public repository, we set max provenance mode.
 | 
					 | 
				
			||||||
      args.push('--attest', `type=provenance,${Build.resolveProvenanceAttrs(`mode=max`)}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (inputs.sbom) {
 | 
					 | 
				
			||||||
    args.push('--attest', Build.resolveAttestationAttrs(`type=sbom,${inputs.sbom}`));
 | 
					 | 
				
			||||||
    sbomSet = true;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // set attests but check if provenance or sbom types already set as
 | 
					  for (let output of (await csvparse(items, {
 | 
				
			||||||
  // provenance and sbom inputs take precedence over attests input.
 | 
					    columns: false,
 | 
				
			||||||
  await Util.asyncForEach(inputs.attests, async (attest: string) => {
 | 
					    relax: true,
 | 
				
			||||||
    if (!Build.hasAttestationType('provenance', attest) && !Build.hasAttestationType('sbom', attest)) {
 | 
					    relaxColumnCount: true,
 | 
				
			||||||
      args.push('--attest', Build.resolveAttestationAttrs(attest));
 | 
					    skipLinesWithEmptyValues: true
 | 
				
			||||||
    } else if (!provenanceSet && Build.hasAttestationType('provenance', attest)) {
 | 
					  })) as Array<string[]>) {
 | 
				
			||||||
      args.push('--attest', Build.resolveProvenanceAttrs(attest));
 | 
					    if (output.length == 1) {
 | 
				
			||||||
    } else if (!sbomSet && Build.hasAttestationType('sbom', attest)) {
 | 
					      res.push(output[0]);
 | 
				
			||||||
      args.push('--attest', attest);
 | 
					      continue;
 | 
				
			||||||
 | 
					    } else if (!ignoreComma) {
 | 
				
			||||||
 | 
					      res.push(...output);
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					    res.push(output.join(','));
 | 
				
			||||||
 | 
					 | 
				
			||||||
  return args;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function noDefaultAttestations(): boolean {
 | 
					  return res.filter(item => item).map(pat => pat.trim());
 | 
				
			||||||
  if (process.env.BUILDX_NO_DEFAULT_ATTESTATIONS) {
 | 
					 | 
				
			||||||
    return Util.parseBool(process.env.BUILDX_NO_DEFAULT_ATTESTATIONS);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
  return false;
 | 
					
 | 
				
			||||||
 | 
					export const asyncForEach = async (array, callback) => {
 | 
				
			||||||
 | 
					  for (let index = 0; index < array.length; index++) {
 | 
				
			||||||
 | 
					    await callback(array[index], index, array);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
 | 
				
			||||||
 | 
					export function setOutput(name: string, value: any): void {
 | 
				
			||||||
 | 
					  issueCommand('set-output', {name}, value);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										299
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										299
									
								
								src/main.ts
									
									
									
									
									
								
							@ -1,296 +1,75 @@
 | 
				
			|||||||
import * as fs from 'fs';
 | 
					import * as fs from 'fs';
 | 
				
			||||||
import * as path from 'path';
 | 
					import * as buildx from './buildx';
 | 
				
			||||||
 | 
					import * as context from './context';
 | 
				
			||||||
import * as stateHelper from './state-helper';
 | 
					import * as stateHelper from './state-helper';
 | 
				
			||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
import * as actionsToolkit from '@docker/actions-toolkit';
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
 | 
					async function run(): Promise<void> {
 | 
				
			||||||
import {History as BuildxHistory} from '@docker/actions-toolkit/lib/buildx/history';
 | 
					 | 
				
			||||||
import {Context} from '@docker/actions-toolkit/lib/context';
 | 
					 | 
				
			||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
 | 
					 | 
				
			||||||
import {Exec} from '@docker/actions-toolkit/lib/exec';
 | 
					 | 
				
			||||||
import {GitHub} from '@docker/actions-toolkit/lib/github';
 | 
					 | 
				
			||||||
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
 | 
					 | 
				
			||||||
import {Util} from '@docker/actions-toolkit/lib/util';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder';
 | 
					 | 
				
			||||||
import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker/docker';
 | 
					 | 
				
			||||||
import {UploadArtifactResponse} from '@docker/actions-toolkit/lib/types/github';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import * as context from './context';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
actionsToolkit.run(
 | 
					 | 
				
			||||||
  // main
 | 
					 | 
				
			||||||
  async () => {
 | 
					 | 
				
			||||||
    const startedTime = new Date();
 | 
					 | 
				
			||||||
    const inputs: context.Inputs = await context.getInputs();
 | 
					 | 
				
			||||||
    stateHelper.setSummaryInputs(inputs);
 | 
					 | 
				
			||||||
    core.debug(`inputs: ${JSON.stringify(inputs)}`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const toolkit = new Toolkit();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await core.group(`GitHub Actions runtime token ACs`, async () => {
 | 
					 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
        await GitHub.printActionsRuntimeTokenACs();
 | 
					    core.startGroup(`Docker info`);
 | 
				
			||||||
      } catch (e) {
 | 
					    await exec.exec('docker', ['version']);
 | 
				
			||||||
        core.warning(e.message);
 | 
					    await exec.exec('docker', ['info']);
 | 
				
			||||||
      }
 | 
					    core.endGroup();
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await core.group(`Docker info`, async () => {
 | 
					    if (!(await buildx.isAvailable())) {
 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        await Docker.printVersion();
 | 
					 | 
				
			||||||
        await Docker.printInfo();
 | 
					 | 
				
			||||||
      } catch (e) {
 | 
					 | 
				
			||||||
        core.info(e.message);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    await core.group(`Proxy configuration`, async () => {
 | 
					 | 
				
			||||||
      let dockerConfig: ConfigFile | undefined;
 | 
					 | 
				
			||||||
      let dockerConfigMalformed = false;
 | 
					 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        dockerConfig = await Docker.configFile();
 | 
					 | 
				
			||||||
      } catch (e) {
 | 
					 | 
				
			||||||
        dockerConfigMalformed = true;
 | 
					 | 
				
			||||||
        core.warning(`Unable to parse config file ${path.join(Docker.configDir, 'config.json')}: ${e}`);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      if (dockerConfig && dockerConfig.proxies) {
 | 
					 | 
				
			||||||
        for (const host in dockerConfig.proxies) {
 | 
					 | 
				
			||||||
          let prefix = '';
 | 
					 | 
				
			||||||
          if (Object.keys(dockerConfig.proxies).length > 1) {
 | 
					 | 
				
			||||||
            prefix = '  ';
 | 
					 | 
				
			||||||
            core.info(host);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          for (const key in dockerConfig.proxies[host]) {
 | 
					 | 
				
			||||||
            core.info(`${prefix}${key}: ${dockerConfig.proxies[host][key]}`);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      } else if (!dockerConfigMalformed) {
 | 
					 | 
				
			||||||
        core.info('No proxy configuration found');
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!(await toolkit.buildx.isAvailable())) {
 | 
					 | 
				
			||||||
      core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
 | 
					      core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    stateHelper.setTmpDir(context.tmpDir());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    stateHelper.setTmpDir(Context.tmpDir());
 | 
					    const buildxVersion = await buildx.getVersion();
 | 
				
			||||||
 | 
					    const defContext = context.defaultContext();
 | 
				
			||||||
 | 
					    let inputs: context.Inputs = await context.getInputs(defContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await core.group(`Buildx version`, async () => {
 | 
					    const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
 | 
				
			||||||
      await toolkit.buildx.printVersion();
 | 
					    await exec
 | 
				
			||||||
    });
 | 
					      .getExecOutput('docker', args, {
 | 
				
			||||||
 | 
					        ignoreReturnCode: true
 | 
				
			||||||
    let builder: BuilderInfo;
 | 
					      })
 | 
				
			||||||
    await core.group(`Builder info`, async () => {
 | 
					      .then(res => {
 | 
				
			||||||
      builder = await toolkit.builder.inspect(inputs.builder);
 | 
					        if (res.stderr.length > 0 && res.exitCode != 0) {
 | 
				
			||||||
      core.info(JSON.stringify(builder, null, 2));
 | 
					          throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)![0].trim()}`);
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const args: string[] = await context.getArgs(inputs, toolkit);
 | 
					 | 
				
			||||||
    core.debug(`context.getArgs: ${JSON.stringify(args)}`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const buildCmd = await toolkit.buildx.getCommand(args);
 | 
					 | 
				
			||||||
    core.debug(`buildCmd.command: ${buildCmd.command}`);
 | 
					 | 
				
			||||||
    core.debug(`buildCmd.args: ${JSON.stringify(buildCmd.args)}`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let err: Error | undefined;
 | 
					 | 
				
			||||||
    await Exec.getExecOutput(buildCmd.command, buildCmd.args, {
 | 
					 | 
				
			||||||
      ignoreReturnCode: true,
 | 
					 | 
				
			||||||
      env: Object.assign({}, process.env, {
 | 
					 | 
				
			||||||
        BUILDX_METADATA_WARNINGS: 'true'
 | 
					 | 
				
			||||||
      }) as {
 | 
					 | 
				
			||||||
        [key: string]: string;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }).then(res => {
 | 
					 | 
				
			||||||
      if (res.exitCode != 0) {
 | 
					 | 
				
			||||||
        if (inputs.call && inputs.call === 'check' && res.stdout.length > 0) {
 | 
					 | 
				
			||||||
          // checks warnings are printed to stdout: https://github.com/docker/buildx/pull/2647
 | 
					 | 
				
			||||||
          // take the first line with the message summaryzing the warnings
 | 
					 | 
				
			||||||
          err = new Error(res.stdout.split('\n')[0]?.trim());
 | 
					 | 
				
			||||||
        } else if (res.stderr.length > 0) {
 | 
					 | 
				
			||||||
          err = new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const imageID = toolkit.buildxBuild.resolveImageID();
 | 
					    const imageID = await buildx.getImageID();
 | 
				
			||||||
    const metadata = toolkit.buildxBuild.resolveMetadata();
 | 
					    const metadata = await buildx.getMetadata();
 | 
				
			||||||
    const digest = toolkit.buildxBuild.resolveDigest(metadata);
 | 
					    const digest = await buildx.getDigest(metadata);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (imageID) {
 | 
					    if (imageID) {
 | 
				
			||||||
      await core.group(`ImageID`, async () => {
 | 
					      await core.group(`ImageID`, async () => {
 | 
				
			||||||
        core.info(imageID);
 | 
					        core.info(imageID);
 | 
				
			||||||
        core.setOutput('imageid', imageID);
 | 
					        context.setOutput('imageid', imageID);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (digest) {
 | 
					    if (digest) {
 | 
				
			||||||
      await core.group(`Digest`, async () => {
 | 
					      await core.group(`Digest`, async () => {
 | 
				
			||||||
        core.info(digest);
 | 
					        core.info(digest);
 | 
				
			||||||
        core.setOutput('digest', digest);
 | 
					        context.setOutput('digest', digest);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (metadata) {
 | 
					    if (metadata) {
 | 
				
			||||||
      await core.group(`Metadata`, async () => {
 | 
					      await core.group(`Metadata`, async () => {
 | 
				
			||||||
        const metadatadt = JSON.stringify(metadata, null, 2);
 | 
					        core.info(metadata);
 | 
				
			||||||
        core.info(metadatadt);
 | 
					        context.setOutput('metadata', metadata);
 | 
				
			||||||
        core.setOutput('metadata', metadatadt);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let ref: string | undefined;
 | 
					 | 
				
			||||||
    await core.group(`Reference`, async () => {
 | 
					 | 
				
			||||||
      ref = await buildRef(toolkit, startedTime, inputs.builder);
 | 
					 | 
				
			||||||
      if (ref) {
 | 
					 | 
				
			||||||
        core.info(ref);
 | 
					 | 
				
			||||||
        stateHelper.setBuildRef(ref);
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        core.info('No build reference found');
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (buildChecksAnnotationsEnabled()) {
 | 
					 | 
				
			||||||
      const warnings = toolkit.buildxBuild.resolveWarnings(metadata);
 | 
					 | 
				
			||||||
      if (ref && warnings && warnings.length > 0) {
 | 
					 | 
				
			||||||
        const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, [ref]);
 | 
					 | 
				
			||||||
        core.debug(`annotations: ${JSON.stringify(annotations, null, 2)}`);
 | 
					 | 
				
			||||||
        if (annotations && annotations.length > 0) {
 | 
					 | 
				
			||||||
          await core.group(`Generating GitHub annotations (${annotations.length} build checks found)`, async () => {
 | 
					 | 
				
			||||||
            for (const annotation of annotations) {
 | 
					 | 
				
			||||||
              core.warning(annotation.message, annotation);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  } catch (error) {
 | 
				
			||||||
 | 
					    core.setFailed(error.message);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await core.group(`Check build summary support`, async () => {
 | 
					async function cleanup(): Promise<void> {
 | 
				
			||||||
      if (!buildSummaryEnabled()) {
 | 
					 | 
				
			||||||
        core.info('Build summary disabled');
 | 
					 | 
				
			||||||
      } else if (inputs.call && inputs.call !== 'build') {
 | 
					 | 
				
			||||||
        core.info(`Build summary skipped for ${inputs.call} subrequest`);
 | 
					 | 
				
			||||||
      } else if (GitHub.isGHES) {
 | 
					 | 
				
			||||||
        core.info('Build summary is not yet supported on GHES');
 | 
					 | 
				
			||||||
      } else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
 | 
					 | 
				
			||||||
        core.info('Build summary requires Buildx >= 0.13.0');
 | 
					 | 
				
			||||||
      } else if (builder && builder.driver === 'cloud') {
 | 
					 | 
				
			||||||
        core.info('Build summary is not yet supported with Docker Build Cloud');
 | 
					 | 
				
			||||||
      } else if (!ref) {
 | 
					 | 
				
			||||||
        core.info('Build summary requires a build reference');
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        core.info('Build summary supported!');
 | 
					 | 
				
			||||||
        stateHelper.setSummarySupported();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (err) {
 | 
					 | 
				
			||||||
      throw err;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  // post
 | 
					 | 
				
			||||||
  async () => {
 | 
					 | 
				
			||||||
    if (stateHelper.isSummarySupported) {
 | 
					 | 
				
			||||||
      await core.group(`Generating build summary`, async () => {
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
          const recordUploadEnabled = buildRecordUploadEnabled();
 | 
					 | 
				
			||||||
          let recordRetentionDays: number | undefined;
 | 
					 | 
				
			||||||
          if (recordUploadEnabled) {
 | 
					 | 
				
			||||||
            recordRetentionDays = buildRecordRetentionDays();
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          const buildxHistory = new BuildxHistory();
 | 
					 | 
				
			||||||
          const exportRes = await buildxHistory.export({
 | 
					 | 
				
			||||||
            refs: stateHelper.buildRef ? [stateHelper.buildRef] : []
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
          core.info(`Build record written to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          let uploadRes: UploadArtifactResponse | undefined;
 | 
					 | 
				
			||||||
          if (recordUploadEnabled) {
 | 
					 | 
				
			||||||
            uploadRes = await GitHub.uploadArtifact({
 | 
					 | 
				
			||||||
              filename: exportRes.dockerbuildFilename,
 | 
					 | 
				
			||||||
              mimeType: 'application/gzip',
 | 
					 | 
				
			||||||
              retentionDays: recordRetentionDays
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          await GitHub.writeBuildSummary({
 | 
					 | 
				
			||||||
            exportRes: exportRes,
 | 
					 | 
				
			||||||
            uploadRes: uploadRes,
 | 
					 | 
				
			||||||
            inputs: stateHelper.summaryInputs
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        } catch (e) {
 | 
					 | 
				
			||||||
          core.warning(e.message);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  if (stateHelper.tmpDir.length > 0) {
 | 
					  if (stateHelper.tmpDir.length > 0) {
 | 
				
			||||||
      await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
 | 
					    core.startGroup(`Removing temp folder ${stateHelper.tmpDir}`);
 | 
				
			||||||
        try {
 | 
					    fs.rmdirSync(stateHelper.tmpDir, {recursive: true});
 | 
				
			||||||
          fs.rmSync(stateHelper.tmpDir, {recursive: true});
 | 
					    core.endGroup();
 | 
				
			||||||
        } catch (e) {
 | 
					 | 
				
			||||||
          core.warning(`Failed to remove temp folder ${stateHelper.tmpDir}`);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
async function buildRef(toolkit: Toolkit, since: Date, builder?: string): Promise<string> {
 | 
					 | 
				
			||||||
  // get ref from metadata file
 | 
					 | 
				
			||||||
  const ref = toolkit.buildxBuild.resolveRef();
 | 
					 | 
				
			||||||
  if (ref) {
 | 
					 | 
				
			||||||
    return ref;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  // otherwise, look for the very first build ref since the build has started
 | 
					 | 
				
			||||||
  if (!builder) {
 | 
					 | 
				
			||||||
    const currentBuilder = await toolkit.builder.inspect();
 | 
					 | 
				
			||||||
    builder = currentBuilder.name;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  const refs = Buildx.refs({
 | 
					 | 
				
			||||||
    dir: Buildx.refsDir,
 | 
					 | 
				
			||||||
    builderName: builder,
 | 
					 | 
				
			||||||
    since: since
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
  return Object.keys(refs).length > 0 ? Object.keys(refs)[0] : '';
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function buildChecksAnnotationsEnabled(): boolean {
 | 
					if (!stateHelper.IsPost) {
 | 
				
			||||||
  if (process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS) {
 | 
					  run();
 | 
				
			||||||
    return Util.parseBool(process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS);
 | 
					} else {
 | 
				
			||||||
  }
 | 
					  cleanup();
 | 
				
			||||||
  return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function buildSummaryEnabled(): boolean {
 | 
					 | 
				
			||||||
  if (process.env.DOCKER_BUILD_NO_SUMMARY) {
 | 
					 | 
				
			||||||
    core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.');
 | 
					 | 
				
			||||||
    return !Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY);
 | 
					 | 
				
			||||||
  } else if (process.env.DOCKER_BUILD_SUMMARY) {
 | 
					 | 
				
			||||||
    return Util.parseBool(process.env.DOCKER_BUILD_SUMMARY);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function buildRecordUploadEnabled(): boolean {
 | 
					 | 
				
			||||||
  if (process.env.DOCKER_BUILD_RECORD_UPLOAD) {
 | 
					 | 
				
			||||||
    return Util.parseBool(process.env.DOCKER_BUILD_RECORD_UPLOAD);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function buildRecordRetentionDays(): number | undefined {
 | 
					 | 
				
			||||||
  let val: string | undefined;
 | 
					 | 
				
			||||||
  if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) {
 | 
					 | 
				
			||||||
    core.warning('DOCKER_BUILD_EXPORT_RETENTION_DAYS is deprecated. Use DOCKER_BUILD_RECORD_RETENTION_DAYS instead.');
 | 
					 | 
				
			||||||
    val = process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS;
 | 
					 | 
				
			||||||
  } else if (process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS) {
 | 
					 | 
				
			||||||
    val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (val) {
 | 
					 | 
				
			||||||
    const res = parseInt(val);
 | 
					 | 
				
			||||||
    if (isNaN(res)) {
 | 
					 | 
				
			||||||
      throw new Error(`Invalid build record retention days: ${val}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return res;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,58 +1,12 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
 | 
					export const IsPost = !!process.env['STATE_isPost'];
 | 
				
			||||||
 | 
					 | 
				
			||||||
import {Inputs} from './context';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const tmpDir = process.env['STATE_tmpDir'] || '';
 | 
					export const tmpDir = process.env['STATE_tmpDir'] || '';
 | 
				
			||||||
export const buildRef = process.env['STATE_buildRef'] || '';
 | 
					 | 
				
			||||||
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
 | 
					 | 
				
			||||||
export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function setTmpDir(tmpDir: string) {
 | 
					export function setTmpDir(tmpDir: string) {
 | 
				
			||||||
  core.saveState('tmpDir', tmpDir);
 | 
					  core.saveState('tmpDir', tmpDir);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function setBuildRef(buildRef: string) {
 | 
					if (!IsPost) {
 | 
				
			||||||
  core.saveState('buildRef', buildRef);
 | 
					  core.saveState('isPost', 'true');
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function setSummarySupported() {
 | 
					 | 
				
			||||||
  core.saveState('isSummarySupported', 'true');
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function setSummaryInputs(inputs: Inputs) {
 | 
					 | 
				
			||||||
  const res = {};
 | 
					 | 
				
			||||||
  for (const key of Object.keys(inputs)) {
 | 
					 | 
				
			||||||
    if (key === 'github-token') {
 | 
					 | 
				
			||||||
      continue;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    const value: string | string[] | boolean = inputs[key];
 | 
					 | 
				
			||||||
    if (typeof value === 'boolean' && !value) {
 | 
					 | 
				
			||||||
      continue;
 | 
					 | 
				
			||||||
    } else if (Array.isArray(value)) {
 | 
					 | 
				
			||||||
      if (value.length === 0) {
 | 
					 | 
				
			||||||
        continue;
 | 
					 | 
				
			||||||
      } else if (key === 'secrets' && value.length > 0) {
 | 
					 | 
				
			||||||
        const secretKeys: string[] = [];
 | 
					 | 
				
			||||||
        for (const secret of value) {
 | 
					 | 
				
			||||||
          try {
 | 
					 | 
				
			||||||
            // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
					 | 
				
			||||||
            const [skey, _] = Build.parseSecretKvp(secret, true);
 | 
					 | 
				
			||||||
            secretKeys.push(skey);
 | 
					 | 
				
			||||||
          } catch (err) {
 | 
					 | 
				
			||||||
            // ignore invalid secret
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (secretKeys.length > 0) {
 | 
					 | 
				
			||||||
          res[key] = secretKeys;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        continue;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    } else if (!value) {
 | 
					 | 
				
			||||||
      continue;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    res[key] = value;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  core.saveState('summaryInputs', JSON.stringify(res));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM alpine
 | 
					FROM alpine
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN echo "Hello world!"
 | 
					RUN echo "Hello world!"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,2 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM busybox
 | 
					FROM busybox
 | 
				
			||||||
RUN cat /etc/hosts
 | 
					RUN cat /etc/hosts
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										3
									
								
								test/buildcontext.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								test/buildcontext.Dockerfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					# syntax=docker/dockerfile-upstream:master
 | 
				
			||||||
 | 
					FROM alpine
 | 
				
			||||||
 | 
					RUN cat /etc/*release
 | 
				
			||||||
@ -1,3 +1,2 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM alpine
 | 
					FROM alpine
 | 
				
			||||||
RUN cat /proc/self/cgroup
 | 
					RUN cat /proc/self/cgroup
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM golang:alpine AS base
 | 
					 | 
				
			||||||
ENV CGO_ENABLED=0
 | 
					 | 
				
			||||||
RUN apk add --no-cache file git
 | 
					 | 
				
			||||||
WORKDIR /src
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM base AS build
 | 
					 | 
				
			||||||
RUN --mount=type=bind,target=/src \
 | 
					 | 
				
			||||||
    --mount=type=cache,target=/root/.cache/go-build \
 | 
					 | 
				
			||||||
    go build -ldflags "-s -w" -o /usr/bin/app .
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM scratch AS binary
 | 
					 | 
				
			||||||
COPY --from=build /usr/bin/app /bin/app
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM alpine AS image
 | 
					 | 
				
			||||||
COPY --from=build /usr/bin/app /bin/app
 | 
					 | 
				
			||||||
EXPOSE 8080
 | 
					 | 
				
			||||||
ENTRYPOINT ["/bin/app"]
 | 
					 | 
				
			||||||
@ -1,3 +0,0 @@
 | 
				
			|||||||
module github.com/docker/build-push-action/test/go
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
go 1.18
 | 
					 | 
				
			||||||
@ -1,14 +0,0 @@
 | 
				
			|||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import (
 | 
					 | 
				
			||||||
	"fmt"
 | 
					 | 
				
			||||||
	"log"
 | 
					 | 
				
			||||||
	"net/http"
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func main() {
 | 
					 | 
				
			||||||
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 | 
					 | 
				
			||||||
		fmt.Fprintf(w, "Hello, Go!")
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
	log.Fatal(http.ListenAndServe(":8080", nil))
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,12 +0,0 @@
 | 
				
			|||||||
frOM busybox as base
 | 
					 | 
				
			||||||
cOpy lint.Dockerfile .
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from scratch
 | 
					 | 
				
			||||||
MAINTAINER moby@example.com
 | 
					 | 
				
			||||||
COPy --from=base \
 | 
					 | 
				
			||||||
  /lint.Dockerfile \
 | 
					 | 
				
			||||||
  /
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
CMD [ "echo", "Hello, Norway!" ]
 | 
					 | 
				
			||||||
CMD [ "echo", "Hello, Sweden!" ]
 | 
					 | 
				
			||||||
ENTRYPOINT my-program start
 | 
					 | 
				
			||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					FROM --platform=$BUILDPLATFORM golang:alpine AS build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM --platform=$BUILDPLATFORM alpine AS build
 | 
					 | 
				
			||||||
ARG TARGETPLATFORM
 | 
					ARG TARGETPLATFORM
 | 
				
			||||||
ARG BUILDPLATFORM
 | 
					ARG BUILDPLATFORM
 | 
				
			||||||
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log
 | 
					RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN apk --update --no-cache add \
 | 
					RUN apk --update --no-cache add \
 | 
				
			||||||
    shadow \
 | 
					    shadow \
 | 
				
			||||||
    sudo \
 | 
					    sudo \
 | 
				
			||||||
@ -13,9 +13,10 @@ RUN apk --update --no-cache add \
 | 
				
			|||||||
  && rm -rf /tmp/* /var/cache/apk/*
 | 
					  && rm -rf /tmp/* /var/cache/apk/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
USER buildx
 | 
					USER buildx
 | 
				
			||||||
RUN sudo chown buildx: /log
 | 
					RUN sudo chown buildx. /log
 | 
				
			||||||
USER root
 | 
					USER root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM alpine
 | 
					FROM alpine
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY --from=build /log /log
 | 
					COPY --from=build /log /log
 | 
				
			||||||
RUN ls -al /log
 | 
					RUN ls -al /log
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,3 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM --platform=$BUILDPLATFORM golang:alpine AS build
 | 
					FROM --platform=$BUILDPLATFORM golang:alpine AS build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARG TARGETPLATFORM
 | 
					ARG TARGETPLATFORM
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM debian
 | 
					 | 
				
			||||||
RUN echo "Hello debian!"
 | 
					 | 
				
			||||||
@ -1,4 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM alpine
 | 
					 | 
				
			||||||
RUN cat /etc/*release
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM busybox AS base
 | 
					 | 
				
			||||||
RUN echo "Hello world!" > /hello
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM alpine AS build
 | 
					 | 
				
			||||||
COPY --from=base /hello /hello
 | 
					 | 
				
			||||||
RUN uname -a
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
FROM build
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM alpine
 | 
					 | 
				
			||||||
RUN apk add --no-cache curl net-tools
 | 
					 | 
				
			||||||
ARG HTTP_PROXY
 | 
					 | 
				
			||||||
ARG HTTPS_PROXY
 | 
					 | 
				
			||||||
RUN printenv HTTP_PROXY
 | 
					 | 
				
			||||||
RUN printenv HTTPS_PROXY
 | 
					 | 
				
			||||||
RUN netstat -aptn
 | 
					 | 
				
			||||||
RUN curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy $HTTP_PROXY -v --insecure --head https://www.google.com
 | 
					 | 
				
			||||||
@ -1,4 +0,0 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM busybox
 | 
					 | 
				
			||||||
RUN --mount=type=secret,id=MYSECRET \
 | 
					 | 
				
			||||||
  echo "MYSECRET=$(cat /run/secrets/MYSECRET)"
 | 
					 | 
				
			||||||
@ -1,3 +1,2 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM busybox
 | 
					FROM busybox
 | 
				
			||||||
RUN mount | grep /dev/shm
 | 
					RUN mount | grep /dev/shm
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,2 @@
 | 
				
			|||||||
# syntax=docker/dockerfile:1
 | 
					 | 
				
			||||||
FROM busybox
 | 
					FROM busybox
 | 
				
			||||||
RUN ulimit -a
 | 
					RUN ulimit -a
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,21 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "compilerOptions": {
 | 
					  "compilerOptions": {
 | 
				
			||||||
    "esModuleInterop": true,
 | 
					 | 
				
			||||||
    "target": "es6",
 | 
					    "target": "es6",
 | 
				
			||||||
    "module": "commonjs",
 | 
					    "module": "commonjs",
 | 
				
			||||||
    "strict": true,
 | 
					    "lib": [
 | 
				
			||||||
 | 
					      "es6",
 | 
				
			||||||
 | 
					      "dom"
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
    "newLine": "lf",
 | 
					    "newLine": "lf",
 | 
				
			||||||
    "outDir": "./lib",
 | 
					    "outDir": "./lib",
 | 
				
			||||||
    "rootDir": "./src",
 | 
					    "rootDir": "./src",
 | 
				
			||||||
    "forceConsistentCasingInFileNames": true,
 | 
					    "strict": true,
 | 
				
			||||||
    "noImplicitAny": false,
 | 
					    "noImplicitAny": false,
 | 
				
			||||||
    "resolveJsonModule": true,
 | 
					    "esModuleInterop": true,
 | 
				
			||||||
    "useUnknownInCatchVariables": false,
 | 
					    "sourceMap": true
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "exclude": [
 | 
					  "exclude": [
 | 
				
			||||||
    "./__mocks__/**/*",
 | 
					 | 
				
			||||||
    "./__tests__/**/*",
 | 
					 | 
				
			||||||
    "./lib/**/*",
 | 
					 | 
				
			||||||
    "node_modules",
 | 
					    "node_modules",
 | 
				
			||||||
    "jest.config.ts"
 | 
					    "**/*.test.ts"
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user