forked from dragonflyoss/dragonfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use buildx to build docker images in e2e (dragonflyoss#1018)
* chore: build images concurrency Signed-off-by: Jim Ma <[email protected]>
- Loading branch information
Showing
10 changed files
with
82 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,12 @@ jobs: | |
mkdir -p /tmp/artifact | ||
go mod vendor | ||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v1 | ||
id: buildx | ||
with: | ||
install: true | ||
|
||
- name: Setup Kind | ||
uses: engineerd/[email protected] | ||
with: | ||
|
@@ -53,11 +59,9 @@ jobs: | |
|
||
- name: Build images | ||
run: | | ||
hack/gen-buildx.sh | ||
make docker-build docker-build-testing-tools | ||
docker pull dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }} | ||
- name: Prepare kind environment | ||
run: | | ||
make kind-load | ||
kind load docker-image dragonflyoss/${{ matrix.module }}:${{ env.DRAGONFLY_STABLE_IMAGE_TAG }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,12 @@ jobs: | |
go mod download github.com/go-task/slim-sprig | ||
go install github.com/onsi/ginkgo/v2/[email protected] | ||
mkdir -p /tmp/artifact | ||
go mod vendor | ||
- name: Setup buildx | ||
uses: docker/setup-buildx-action@v1 | ||
id: buildx | ||
with: | ||
install: true | ||
|
||
- name: Setup Kind | ||
uses: engineerd/[email protected] | ||
|
@@ -47,10 +52,10 @@ jobs: | |
config: ${{ env.KIND_CONFIG_PATH }} | ||
|
||
- name: Build images | ||
run: make docker-build docker-build-testing-tools | ||
|
||
- name: Prepare kind environment | ||
run: make kind-load | ||
run: | | ||
hack/gen-buildx.sh | ||
make docker-build docker-build-testing-tools | ||
make kind-load | ||
- name: Setup dragonfly | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
components="cdn scheduler manager" | ||
|
||
set -x | ||
|
||
for c in ${components}; do | ||
file=build/images/"${c}"/Dockerfile | ||
sed -i '1i# syntax=docker/dockerfile:1.3' "${file}" | ||
sed -i "s#RUN make build-$c && make install-$c#RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/ export GOPATH=/root/go \&\& make build-$c \&\& make install-$c#" "${file}" | ||
done | ||
|
||
# dfdaemon is subcommand, need to update alone | ||
sed -i '1i# syntax=docker/dockerfile:1.3' build/images/dfdaemon/Dockerfile | ||
sed -i "s#RUN make build-dfget && make install-dfget#RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/ export GOPATH=/root/go \&\& make build-dfget \&\& make install-dfget#" build/images/dfdaemon/Dockerfile | ||
|
||
# buildx need "--load" to export images to docker | ||
sed -i 's/docker build/docker build --load/' hack/docker-build.sh | ||
sed -i 's/docker build/docker build --load/' test/tools/no-content-length/build.sh | ||
|
||
# TODO build console in https://github.com/dragonflyoss/console, and build image with github action cache | ||
# remove npm build, use "make build-manager-console" separated | ||
# sed -i '12,18d' build/images/manager/Dockerfile | ||
# sed -i 's#COPY --from=console-builder /build/dist /opt/dragonfly/manager/console/dist#COPY ./manager/console/dist /opt/dragonfly/manager/console/dist#' build/images/manager/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters