mirror of
https://github.com/docker/bake-action.git
synced 2026-06-05 17:48:40 +02:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7cf3c8378f | |||
| 301b8aecd8 | |||
| 51bdb56af6 | |||
| 57d3ed4828 | |||
| 2654df7d45 | |||
| adc72eac06 | |||
| 0d2af1989e | |||
| 628236761c | |||
| e426bb34c2 | |||
| 97b074fb7f |
@@ -1,11 +0,0 @@
|
|||||||
https://github.com/homoluctus/slatify/
|
|
||||||
https://github.com/technote-space/toc-generator/commit/06ca2702bc545e4c2a31bc8b6cfd052de59b0af5/checks?check_suite_id=250009775
|
|
||||||
https://github.com/technote-space/release-github-actions
|
|
||||||
|
|
||||||
|
|
||||||
docker buildx rm builder
|
|
||||||
docker run --rm --privileged multiarch/qemu-user-static:register --reset -p yes --credential yes
|
|
||||||
docker buildx create --name builder --driver docker-container --use
|
|
||||||
docker buildx inspect --bootstrap
|
|
||||||
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x --output "type=image,push=false" -t buildx --file ./test/Dockerfile-sudo ./test
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
create
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- releases/*
|
|
||||||
paths:
|
|
||||||
- src/*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
ref: remotes/origin/releases/v1
|
|
||||||
-
|
|
||||||
name: Git checkout
|
|
||||||
run: git checkout -b releases/v1
|
|
||||||
-
|
|
||||||
name: Install
|
|
||||||
run: npm install
|
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
run: npm run build
|
|
||||||
-
|
|
||||||
name: Not ignore node_modules
|
|
||||||
run: sed -i '/node_modules*/d' .gitignore
|
|
||||||
-
|
|
||||||
name: Install production deps
|
|
||||||
run: |
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install --production
|
|
||||||
-
|
|
||||||
name: Setup Git
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
git config user.name "${GITHUB_ACTOR}"
|
|
||||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
||||||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
|
|
||||||
-
|
|
||||||
name: Git commit
|
|
||||||
run: |
|
|
||||||
git add -A
|
|
||||||
DIFF=`git diff --cached --numstat | wc -l`
|
|
||||||
if [ $DIFF -eq 0 ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
git commit -am 'Build for release'
|
|
||||||
-
|
|
||||||
name: Git push
|
|
||||||
run: git push origin HEAD
|
|
||||||
|
|
||||||
check:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
needs: release
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
- latest
|
|
||||||
- v0.2.2
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: crazy-max/ghaction-docker-buildx@releases/v1
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
-
|
|
||||||
name: Available platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
||||||
-
|
|
||||||
name: Run Buildx
|
|
||||||
run: |
|
|
||||||
docker buildx build \
|
|
||||||
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x \
|
|
||||||
--output "type=image,push=false" \
|
|
||||||
--file ./test/Dockerfile ./test
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/.dev
|
||||||
|
/coverage
|
||||||
|
/dist
|
||||||
|
/lib
|
||||||
|
/node_modules
|
||||||
|
/.env
|
||||||
@@ -8,12 +8,13 @@ Contributions to this project are [released](https://help.github.com/articles/gi
|
|||||||
|
|
||||||
1. [Fork](https://github.com/crazy-max/ghaction-docker-buildx-bake/fork) and clone the repository
|
1. [Fork](https://github.com/crazy-max/ghaction-docker-buildx-bake/fork) and clone the repository
|
||||||
2. Configure and install the dependencies: `yarn install`
|
2. Configure and install the dependencies: `yarn install`
|
||||||
3. Make sure the tests pass on your machine: `yarn run test`
|
3. Create a new branch: `git checkout -b my-branch-name`
|
||||||
4. Create a new branch: `git checkout -b my-branch-name`
|
4. Make your changes
|
||||||
5. Make your change, add tests, and make sure the tests still pass
|
5. Make sure the tests pass: `docker buildx bake test`
|
||||||
6. Run pre-checkin: `yarn run pre-checkin`
|
6. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||||
7. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-docker-buildx-bake/compare)
|
7. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||||
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
8. Push to your fork and [submit a pull request](https://github.com/crazy-max/ghaction-docker-buildx-bake/compare)
|
||||||
|
9. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||||
|
|
||||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Number of days of inactivity before an issue becomes stale
|
||||||
|
daysUntilStale: 30
|
||||||
|
# Number of days of inactivity before a stale issue is closed
|
||||||
|
daysUntilClose: 7
|
||||||
|
# Issues with these labels will never be considered stale
|
||||||
|
exemptLabels:
|
||||||
|
- ":hand: hold"
|
||||||
|
# Set to true to ignore issues in a milestone (defaults to false)
|
||||||
|
exemptMilestones: true
|
||||||
|
# Label to use when marking an issue as stale
|
||||||
|
staleLabel: ":skull: stale"
|
||||||
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
|
closeComment: false
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Run Labeler
|
name: Run Labeler
|
||||||
uses: crazy-max/ghaction-github-labeler@v3.1.0
|
uses: crazy-max/ghaction-github-labeler@v3
|
||||||
|
|||||||
@@ -3,10 +3,15 @@ name: test
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- 'master'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -14,17 +19,13 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2.3.3
|
uses: actions/checkout@v2
|
||||||
-
|
|
||||||
name: Install
|
|
||||||
run: yarn install
|
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
run: yarn run test
|
run: docker buildx bake test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1.0.13
|
uses: codecov/codecov-action@v1
|
||||||
if: success()
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: validate
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Validate
|
||||||
|
run: docker buildx bake validate
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/.dev
|
||||||
node_modules
|
node_modules
|
||||||
lib
|
lib
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#syntax=docker/dockerfile:1.2
|
||||||
|
|
||||||
|
FROM node:12 AS deps
|
||||||
|
WORKDIR /src
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
FROM scratch AS update-yarn
|
||||||
|
COPY --from=deps /src/yarn.lock /
|
||||||
|
|
||||||
|
FROM deps AS validate-yarn
|
||||||
|
COPY .git .git
|
||||||
|
RUN status=$(git status --porcelain -- yarn.lock); if [ -n "$status" ]; then echo $status; exit 1; fi
|
||||||
|
|
||||||
|
FROM deps AS base
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
FROM base AS build
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
FROM deps AS test
|
||||||
|
COPY --from=docker /usr/local/bin/docker /usr/bin/
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ENV RUNNER_TEMP=/tmp/github_runner
|
||||||
|
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||||
|
ARG BUILDX_VERSION=v0.5.1
|
||||||
|
RUN mkdir -p /usr/local/lib/docker/cli-plugins \
|
||||||
|
&& curl -fsSL https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.$TARGETOS-$TARGETARCH > /usr/local/lib/docker/cli-plugins/docker-buildx \
|
||||||
|
&& chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx \
|
||||||
|
&& docker buildx version
|
||||||
|
COPY . .
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run test
|
||||||
|
|
||||||
|
FROM scratch AS test-coverage
|
||||||
|
COPY --from=test /src/coverage /coverage/
|
||||||
|
|
||||||
|
FROM base AS run-format
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format
|
||||||
|
|
||||||
|
FROM scratch AS format
|
||||||
|
COPY --from=run-format /src/src/*.ts /src/
|
||||||
|
|
||||||
|
FROM base AS validate-format
|
||||||
|
RUN --mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format-check
|
||||||
|
|
||||||
|
FROM scratch AS dist
|
||||||
|
COPY --from=build /src/dist/ /dist/
|
||||||
|
|
||||||
|
FROM build AS validate-build
|
||||||
|
RUN status=$(git status --porcelain -- dist); if [ -n "$status" ]; then echo $status; exit 1; fi
|
||||||
|
|
||||||
|
FROM base AS dev
|
||||||
|
ENTRYPOINT ["bash"]
|
||||||
@@ -31,6 +31,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: master
|
branches: master
|
||||||
tags:
|
tags:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bake:
|
bake:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -43,7 +44,6 @@ jobs:
|
|||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
@@ -55,13 +55,11 @@ jobs:
|
|||||||
name: Build and push
|
name: Build and push
|
||||||
uses: crazy-max/ghaction-docker-buildx-bake@v1
|
uses: crazy-max/ghaction-docker-buildx-bake@v1
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
|
||||||
push: true
|
|
||||||
files: |
|
files: |
|
||||||
./config.hcl
|
./config.hcl
|
||||||
targets: |
|
targets: |
|
||||||
default
|
|
||||||
release
|
release
|
||||||
|
push: true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|||||||
+896
-38
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,54 @@
|
|||||||
|
group "default" {
|
||||||
|
targets = ["build"]
|
||||||
|
}
|
||||||
|
|
||||||
|
group "pre-checkin" {
|
||||||
|
targets = ["update-yarn", "format", "build"]
|
||||||
|
}
|
||||||
|
|
||||||
|
group "validate" {
|
||||||
|
targets = ["validate-format", "validate-build", "validate-yarn"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "dockerfile" {
|
||||||
|
dockerfile = "Dockerfile.dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "update-yarn" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "update-yarn"
|
||||||
|
output = ["."]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "build" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "dist"
|
||||||
|
output = ["."]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "test" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "test-coverage"
|
||||||
|
output = ["."]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "format" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "format"
|
||||||
|
output = ["."]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-format" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "validate-format"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-build" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "validate-build"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-yarn" {
|
||||||
|
inherits = ["dockerfile"]
|
||||||
|
target = "validate-yarn"
|
||||||
|
}
|
||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^4.0.0",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.4",
|
||||||
"tmp": "^0.2.1"
|
"tmp": "^0.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+3
-1
@@ -21,9 +21,11 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
let inputs: context.Inputs = await context.getInputs();
|
let inputs: context.Inputs = await context.getInputs();
|
||||||
|
|
||||||
core.info(`🏃 Starting bake...`);
|
core.startGroup(`🏃 Starting bake...`);
|
||||||
const args: string[] = await context.getArgs(inputs, buildxVersion);
|
const args: string[] = await context.getArgs(inputs, buildxVersion);
|
||||||
|
await exec.exec('docker', [...args, '--print']);
|
||||||
await exec.exec('docker', args);
|
await exec.exec('docker', args);
|
||||||
|
core.endGroup();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user