mirror of
https://github.com/docker/build-push-action.git
synced 2026-07-02 13:01:38 +00:00
Compare commits
14 Commits
f26add4027
...
380260b6c7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
380260b6c7 | ||
|
|
ac790be09a | ||
|
|
dc0a85b056 | ||
|
|
4b0752a2b1 | ||
|
|
be06a9da57 | ||
|
|
19184b90ca | ||
|
|
57e90a56ab | ||
|
|
4fad532b9f | ||
|
|
413aee355f | ||
|
|
f05b754b57 | ||
|
|
2f3765570b | ||
|
|
68d0dc20df | ||
|
|
1fd7f72e60 | ||
|
|
ea907fb0a4 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -1 +0,0 @@
|
||||
* @crazy-max
|
||||
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@ -11,6 +11,7 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
versioning-strategy: "increase"
|
||||
allow:
|
||||
- dependency-type: "production"
|
||||
labels:
|
||||
|
||||
71
.github/workflows/ci.yml
vendored
71
.github/workflows/ci.yml
vendored
@ -1001,3 +1001,74 @@ jobs:
|
||||
file: ./test/named-context.Dockerfile
|
||||
build-contexts: |
|
||||
alpine=docker-image://localhost:5000/my-base-image:latest
|
||||
|
||||
proxy-docker-config:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
squid-proxy:
|
||||
image: ubuntu/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
steps:
|
||||
-
|
||||
name: Check proxy
|
||||
run: |
|
||||
netstat -aptn
|
||||
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Set proxy config
|
||||
run: |
|
||||
mkdir -p ~/.docker
|
||||
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||
driver-opts: |
|
||||
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||
network=host
|
||||
buildkitd-flags: --debug
|
||||
-
|
||||
name: Build
|
||||
uses: ./
|
||||
with:
|
||||
context: ./test
|
||||
file: ./test/proxy.Dockerfile
|
||||
|
||||
proxy-buildkitd:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
squid-proxy:
|
||||
image: ubuntu/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
steps:
|
||||
-
|
||||
name: Check proxy
|
||||
run: |
|
||||
netstat -aptn
|
||||
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||
driver-opts: |
|
||||
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||
network=host
|
||||
env.http_proxy=http://127.0.0.1:3128
|
||||
env.https_proxy=http://127.0.0.1:3128
|
||||
buildkitd-flags: --debug
|
||||
-
|
||||
name: Build
|
||||
uses: ./
|
||||
with:
|
||||
context: ./test
|
||||
file: ./test/Dockerfile
|
||||
|
||||
4
.github/workflows/e2e.yml
vendored
4
.github/workflows/e2e.yml
vendored
@ -105,8 +105,8 @@ jobs:
|
||||
type: remote
|
||||
-
|
||||
name: Artifactory
|
||||
registry: buildkitghactiontests.jfrog.io
|
||||
slug: buildkitghactiontests.jfrog.io/ghactiontest/test-docker-action
|
||||
registry: sforzando-build-team-local.jfrog.io
|
||||
slug: sforzando-build-team-local.jfrog.io/build-push-action-e2e
|
||||
username_secret: ARTIFACTORY_USERNAME
|
||||
password_secret: ARTIFACTORY_TOKEN
|
||||
type: remote
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* [BuildKit container logs](#buildkit-container-logs)
|
||||
* [With containerd](#with-containerd)
|
||||
* [`repository name must be lowercase`](#repository-name-must-be-lowercase)
|
||||
* [Image not loaded](#image-not-loaded)
|
||||
|
||||
## Cannot push to a registry
|
||||
|
||||
@ -135,3 +136,29 @@ Or a dedicated step to sanitize the slug:
|
||||
push: true
|
||||
tags: ${{ steps.repo_slug.outputs.result }}:latest
|
||||
```
|
||||
|
||||
## Image not loaded
|
||||
|
||||
Sometimes when your workflows are heavy consumers of disk storage, it can happen that build-push-action declares that the built image is loaded, but then not found in the following workflow steps.
|
||||
|
||||
- You can use the following solution as workaround, to free space on disk before building docker image using the following workflow step
|
||||
|
||||
```yaml
|
||||
# Free disk space
|
||||
- name: Free Disk space
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
|
||||
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
|
||||
```
|
||||
|
||||
- Another workaround can be to call `docker/setup-buildx-action` with docker driver
|
||||
|
||||
```yaml
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
driver: docker
|
||||
```
|
||||
|
||||
More details in the [related issue](https://github.com/docker/build-push-action/issues/321)
|
||||
|
||||
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@docker/actions-toolkit": "^0.5.0",
|
||||
"@docker/actions-toolkit": "^0.6.0",
|
||||
"handlebars": "^4.7.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
16
src/main.ts
16
src/main.ts
@ -34,6 +34,22 @@ actionsToolkit.run(
|
||||
}
|
||||
});
|
||||
|
||||
const dockerConfig = await Docker.configFile();
|
||||
if (dockerConfig && dockerConfig.proxies) {
|
||||
await core.group(`Proxy configuration found`, async () => {
|
||||
for (const host in dockerConfig.proxies) {
|
||||
let prefix = '';
|
||||
if (dockerConfig.proxies.length > 1) {
|
||||
prefix = ' ';
|
||||
core.info(host);
|
||||
}
|
||||
for (const key in dockerConfig.proxies[host]) {
|
||||
core.info(`${prefix}${key}: ${dockerConfig.proxies[host][key]}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!(await toolkit.buildx.isAvailable())) {
|
||||
core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
|
||||
return;
|
||||
|
||||
9
test/proxy.Dockerfile
Normal file
9
test/proxy.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
# 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
|
||||
44
yarn.lock
44
yarn.lock
@ -598,10 +598,10 @@
|
||||
dependencies:
|
||||
"@jridgewell/trace-mapping" "0.3.9"
|
||||
|
||||
"@docker/actions-toolkit@^0.5.0":
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.5.0.tgz#4f2c215a1e67ce27edb10acf658b5289f8da7d7e"
|
||||
integrity sha512-VgU9KDmCgSVqpLwNVkf4JUP8Bg38dymuDJhMU0A5DRXtII/K+85peEY/in6U7ThyO1wSSef19ImpiIKYLFBqvA==
|
||||
"@docker/actions-toolkit@^0.6.0":
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.6.0.tgz#651e408dfeea7988ed9b4ddaed46ae67a741651b"
|
||||
integrity sha512-f3QurtwyyK4NQiMCKvziGkBibSbEaJI8DP3atTWStk758tnBskN4grm1neNLLGARZQNNJhCBc3YDUTURHorzOg==
|
||||
dependencies:
|
||||
"@actions/core" "^1.10.0"
|
||||
"@actions/exec" "^1.1.1"
|
||||
@ -609,12 +609,12 @@
|
||||
"@actions/http-client" "^2.0.1"
|
||||
"@actions/io" "^1.1.2"
|
||||
"@actions/tool-cache" "^2.0.1"
|
||||
"@octokit/plugin-rest-endpoint-methods" "^7.2.1"
|
||||
"@octokit/plugin-rest-endpoint-methods" "^7.2.3"
|
||||
async-retry "^1.3.3"
|
||||
csv-parse "^5.4.0"
|
||||
handlebars "^4.7.7"
|
||||
jwt-decode "^3.1.2"
|
||||
semver "^7.5.1"
|
||||
semver "^7.5.3"
|
||||
tmp "^0.2.1"
|
||||
|
||||
"@eslint-community/eslint-utils@^4.2.0":
|
||||
@ -1023,12 +1023,12 @@
|
||||
"@octokit/types" "^6.34.0"
|
||||
deprecation "^2.3.1"
|
||||
|
||||
"@octokit/plugin-rest-endpoint-methods@^7.2.1":
|
||||
version "7.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.1.tgz#0e086930c8b4470b0eabaa7d68b67fd1b245bb3a"
|
||||
integrity sha512-UmlNrrcF+AXxcxhZslTt1a/8aDxUKH0trrt/mJCxEPrWbW1ZEc+6xxcd5/n0iw3b+Xo8UBJQUKDr71+vNCBpRQ==
|
||||
"@octokit/plugin-rest-endpoint-methods@^7.2.3":
|
||||
version "7.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.3.tgz#37a84b171a6cb6658816c82c4082ac3512021797"
|
||||
integrity sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA==
|
||||
dependencies:
|
||||
"@octokit/types" "^9.3.1"
|
||||
"@octokit/types" "^10.0.0"
|
||||
|
||||
"@octokit/request-error@^2.0.0":
|
||||
version "2.0.2"
|
||||
@ -1083,6 +1083,13 @@
|
||||
node-fetch "^2.6.7"
|
||||
universal-user-agent "^6.0.0"
|
||||
|
||||
"@octokit/types@^10.0.0":
|
||||
version "10.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-10.0.0.tgz#7ee19c464ea4ada306c43f1a45d444000f419a4a"
|
||||
integrity sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==
|
||||
dependencies:
|
||||
"@octokit/openapi-types" "^18.0.0"
|
||||
|
||||
"@octokit/types@^5.0.0", "@octokit/types@^5.0.1":
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-5.4.1.tgz#d5d5f2b70ffc0e3f89467c3db749fa87fc3b7031"
|
||||
@ -1104,13 +1111,6 @@
|
||||
dependencies:
|
||||
"@octokit/openapi-types" "^11.2.0"
|
||||
|
||||
"@octokit/types@^9.3.1":
|
||||
version "9.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-9.3.1.tgz#9eb20390f8cfcc975635d813f9a2094efd4aa2dd"
|
||||
integrity sha512-zfJzyXLHC42sWcn2kS+oZ/DRvFZBYCCbfInZtwp1Uopl1qh6pRg4NSP/wFX1xCOpXvEkctiG1sxlSlkZmzvxdw==
|
||||
dependencies:
|
||||
"@octokit/openapi-types" "^18.0.0"
|
||||
|
||||
"@sinclair/typebox@^0.25.16":
|
||||
version "0.25.24"
|
||||
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718"
|
||||
@ -3255,10 +3255,10 @@ safe-buffer@~5.1.1:
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
||||
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
||||
|
||||
semver@7.x, semver@^7.3.5, semver@^7.3.7, semver@^7.5.1:
|
||||
version "7.5.1"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec"
|
||||
integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==
|
||||
semver@7.x, semver@^7.3.5, semver@^7.3.7, semver@^7.5.3:
|
||||
version "7.5.3"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e"
|
||||
integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==
|
||||
dependencies:
|
||||
lru-cache "^6.0.0"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user