18 Commits
0.0.1 ... 0.1.0

Author SHA1 Message Date
e4bfd4b5fc build(version): bump version 0.0.1 → 0.1.0 2023-05-15 03:07:35 +00:00
Jon
d97525e193 Merge branch 'genesis' into 'development'
refactor: update project

See merge request nofusscomputing/projects/docker-buildx-qemu!1
2023-05-15 02:20:53 +00:00
Jon
45747fe6e0 ci: update to current gitlab-ci project dev head
incorporates changes from nofusscomputing/projects/gitlab-ci!17

!1 nofusscomputing/projects/gitlab-ci!17
2023-05-15 10:57:11 +09:30
Jon
9cabecb460 chore: update submodule to current dev
!1
2023-05-14 16:16:58 +09:30
Jon
b229fd8eb9 ci: enable jobs validation and git mirror and release
!1
2023-05-13 15:46:49 +09:30
Jon
be82a6cc90 ci: add sync to github
!1
2023-05-13 15:26:15 +09:30
Jon
76b3b6d6c1 ci: completely use gitlab-ci project for pipeline
!1
2023-05-13 15:13:42 +09:30
Jon
80a440f855 fix: libc issues workaround added
!1
2023-05-13 15:13:10 +09:30
Jon
b242911657 fix: set apt to be noninteractive
!1
2023-05-13 15:12:14 +09:30
Jon
8af1cee946 feat(software): install git
!1
2023-05-13 15:11:09 +09:30
Jon
069a47808a feat(software): install buildx plugin from docker repo
!1
2023-05-13 15:10:41 +09:30
Jon
92c1cefb95 feat(image): add python3 and pip
!1
2023-05-13 15:09:17 +09:30
Jon
03c98a8c81 feat(ci): use nfc gitlab-ci project
!1
2023-05-13 15:07:26 +09:30
Jon
d86b5b35df feat(build): add commitizen for versioning
!1
2023-05-13 15:06:33 +09:30
Jon
72a0c3f9d7 docs: clean readme
!1
2023-05-13 15:05:43 +09:30
Jon
ef1c9501f5 ci(build): don't retry build
dont auto retry as a failure should be investigated

!1
2023-05-12 10:44:33 +09:30
Jon
7f1ce78610 chore: add licence
!1
2023-05-12 10:43:41 +09:30
Jon
00ec401689 chore: remove additional gitlab-ci file
!1
2023-05-12 10:43:27 +09:30
9 changed files with 93 additions and 242 deletions

7
.cz.yaml Normal file
View File

@ -0,0 +1,7 @@
commitizen:
bump_message: "build(version): bump version $current_version \u2192 $new_version"
changelog_incremental: false
name: cz_conventional_commits
tag_format: $major.$minor.$patch$prerelease
update_changelog_on_bump: true
version: 0.1.0

View File

@ -1,124 +1,23 @@
# available variables, do not uncomment all at once.
# variables:
# CI_BUILDX_ARCHS: "linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7"
# CI_BUILD_ARM: true
# CI_BUILD_ARM64: true
# CI_AMD64_DISABLED: true
.build:
image: docker:dind
stage: build
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
retry: 2
before_script:
- |
if [[ -z "$CI_COMMIT_TAG" ]]; then
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_SHA}
else
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
fi
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
include:
- project: nofusscomputing/projects/gitlab-ci
ref: development
file:
- .gitlab-ci_common.yaml
- type/docker-image.gitlab-ci.yaml
# these images depend on this repos image
# it must exist for for the arch that the gitlab-runner has.
build:buildx-master:
extends: .build
# set the image because we are using buildx here.
image: $CI_REGISTRY_IMAGE:latest
only:
refs:
- master
variables:
- $CI_BUILDX_ARCHS
script:
# Use docker-container driver to allow useful features (push/multi-platform)
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
- docker buildx ls
- docker buildx build --platform $CI_BUILDX_ARCHS --progress plain --pull -t "$CI_REGISTRY_IMAGE" --push .
build:buildx:
extends: .build
# set the image because we are using buildx here.
image: $CI_REGISTRY_IMAGE:latest
only:
variables:
- $CI_BUILDX_ARCHS
except:
refs:
- master
script:
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
- docker buildx ls
- docker buildx build --platform $CI_BUILDX_ARCHS --progress plain --pull -t "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG" --push .
variables:
MY_PROJECT_ID: "45926238"
# disable build:armv7 for now since it seems to have an issue with dind
.build:arm:
extends: .build
only:
variables:
- $CI_BUILD_ARM
except:
variables:
- $CI_BUILDX_ARCHS
tags:
- arm
script:
- docker build -t "$CI_APPLICATION_REPOSITORY/arm:$CI_APPLICATION_TAG" .
- docker push "$CI_APPLICATION_REPOSITORY/arm:$CI_APPLICATION_TAG"
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/docker-buildx-qemu.git"
build:arm64:
extends: .build
only:
variables:
- $CI_BUILD_ARM64
except:
variables:
- $CI_BUILDX_ARCHS
tags:
- arm64
#JOB_STOP_CONVENTIONAL_COMMITS: 'disable for testing'
#JOB_STOP_GIT_PUSH_MIRROR: 'disable for testing'
#JOB_STOP_GITLAB_RELEASE: 'disable for testing'
script:
- docker build -t "$CI_APPLICATION_REPOSITORY/arm64:$CI_APPLICATION_TAG" .
- docker push "$CI_APPLICATION_REPOSITORY/arm64:$CI_APPLICATION_TAG"
# builds this by default
build:amd64:
extends: .build
except:
variables:
- $CI_AMD64_DISABLED
- $CI_BUILDX_ARCHS
script:
- docker build -t "$CI_APPLICATION_REPOSITORY/amd64:$CI_APPLICATION_TAG" .
- docker push "$CI_APPLICATION_REPOSITORY/amd64:$CI_APPLICATION_TAG"
build:manifest:
extends: .build
stage: deploy
except:
variables:
- $CI_BUILDX_ARCHS
script:
- echo "Checking amd86 build..." && [[ -z $CI_AMD64_DISABLED ]] && echo "found" && export CI_MANIFEST_LIST="$CI_APPLICATION_REPOSITORY/amd64:$CI_APPLICATION_TAG"
- echo "Checking arm build..." && [[ $CI_BUILD_ARM ]] && echo "found" && export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APPLICATION_REPOSITORY/arm:$CI_APPLICATION_TAG"
- echo "Checking arm64 build..." && [[ $CI_BUILD_ARM64 ]] && echo "found" && export CI_MANIFEST_LIST="$CI_MANIFEST_LIST $CI_APPLICATION_REPOSITORY/arm64:$CI_APPLICATION_TAG"
- export DOCKER_CLI_EXPERIMENTAL=enabled
- echo $CI_MANIFEST_LIST
- docker manifest create $CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG $CI_MANIFEST_LIST && docker manifest push $CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG
- docker manifest create $CI_APPLICATION_REPOSITORY:latest $CI_MANIFEST_LIST && docker manifest push $CI_APPLICATION_REPOSITORY:latest
- echo "Checking master" && [[ $CI_COMMIT_REF_NAME == "master" ]] && docker manifest create $CI_REGISTRY_IMAGE:latest $CI_MANIFEST_LIST && docker manifest push $CI_REGISTRY_IMAGE:latest
DOCKER_IMAGE_BUILD_TARGET_PLATFORMS: "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6"
DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME
DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing
DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "gitlab-ci"]
path = gitlab-ci
url = https://gitlab.com/nofusscomputing/projects/gitlab-ci.git
branch = development

32
CHANGELOG.md Normal file
View File

@ -0,0 +1,32 @@
## 0.1.0 (2023-05-15)
### Bug Fixes
- [80a440f8](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/80a440f855757c3d3e2b058fbd39fe2fc4484fb3) - libc issues workaround added [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- [b2429116](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/b24291165772b415800a68dd40e048ce666af0be) - set apt to be noninteractive [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
### Continious Integration
- [45747fe6](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/45747fe6e0d54c3168cf90764952b756b21edf65) - update to current gitlab-ci project dev head [ [!17](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/17) [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) [!17](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/17) ]
- [b229fd8e](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/b229fd8eb9a06d7a09e6538777b7e27938ff2ac6) - enable jobs validation and git mirror and release [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- [be82a6cc](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/be82a6cc90508ff628768657024c53cac9745bb4) - add sync to github [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- [76b3b6d6](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/76b3b6d6c11672b579106e5911fa67b8fcdb3a7e) - completely use gitlab-ci project for pipeline [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- **build**: [ef1c9501](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/ef1c9501f51c9e4d969e66e9d488181dcc36c76b) - don't retry build [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
### Documentaton / Guides
- [72a0c3f9](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/72a0c3f9d7f0cbdb4da49437242eba7d0d3e339f) - clean readme [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
### Features
- **software**: [8af1cee9](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/8af1cee94657544b07f14103b257e04b57f0b781) - install git [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- **software**: [069a4780](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/069a47808a44b0cd1b23e2b526e28aca688406b0) - install buildx plugin from docker repo [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- **image**: [92c1cefb](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/92c1cefb9550ec526d3149edb33d43e25dcdfd75) - add python3 and pip [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- **ci**: [03c98a8c](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/03c98a8c814e0b26fb67949b96374fc6a35944a9) - use nfc gitlab-ci project [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
- **build**: [d86b5b35](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/d86b5b35df494dfbc332b41035d2acf40d6fe1b4) - add commitizen for versioning [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]
## 0.0.1 (2023-05-12)
### Documentaton / Guides
- **readme**: [2b65dcbd](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/commit/2b65dcbdeda1b29517735a3d87fcd2ba1014acaa) - updated to current format [ [!1](https://gitlab.com/nofusscomputing/projects/docker-buildx-qemu/-/merge_requests/1) ]

View File

@ -1,26 +1,37 @@
FROM debian
# Install Docker and qemu
# TODO Use docker stable once it properly supports buildx
RUN apt-get update && apt-get install -y \
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt --fix-broken install \
&& apt install -y libc-bin locales-all
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
git \
gnupg2 \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
software-properties-common \
python3 \
python3-pip || true
# Install Docker and qemu
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
add-apt-repository "deb https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
apt-get update && apt-get install -y \
docker-buildx-plugin \
docker-ce-cli \
binfmt-support \
qemu-user-static
qemu-user-static || true
# Install buildx plugin
RUN mkdir -p ~/.docker/cli-plugins && \
ARCH=`dpkg --print-architecture` && echo Running on $ARCH && curl -s https://api.github.com/repos/docker/buildx/releases/latest | \
grep "browser_download_url.*linux-$ARCH" | cut -d : -f 2,3 | tr -d \" | \
xargs curl -L -o ~/.docker/cli-plugins/docker-buildx && \
chmod a+x ~/.docker/cli-plugins/docker-buildx
# Write version file
RUN printf "$(docker --version | perl -pe 's/^.*\s(\d+\.\d+\.\d+.*),.*$/$1/')_$(docker buildx version | perl -pe 's/^.*v?(\d+\.\d+\.\d+).*$/$1/')" > /version && \
cat /version
RUN echo "[DEBUG] why arm64 reports no docker 'which docker'=[$(which docker)]"

10
LICENSE Normal file
View File

@ -0,0 +1,10 @@
MIT License
Copyright
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -55,70 +55,3 @@ For further details on contributing please refer to the [contribution guide](CON
## Other
This repo is release under this [license](LICENSE)
<details>
<summary>Original README.md</summary>
# docker-buildx-qemu
> this is a fork of https://gitlab.com/ericvh/docker-buildx-qemu
> it has been modified to not depend on a gitlab-ci template repository.
This Debian-based image allows you to easily build cross-platform images.
It's been tested with GitLab CI on gitlab.com, but it should work anywhere that docker-in-docker already works, and with a binfmt_misc enabled kernel.
## Example Usage
This GitLab example should give you an idea of how to use the image.
Dockerfile
```dockerfile
FROM alpine
RUN echo "Hello, my CPU architecture is $(uname -m)"
```
.gitlab-ci.yml
```yaml
variables:
CI_BUILD_ARCHS: "linux/arm/v7,linux/arm64,linux/amd64"
CI_BUILD_IMAGE: "registry.gitlab.com/ericvh/docker-buildx-qemu"
build:
image: $CI_BUILD_IMAGE
stage: build
services:
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
retry: 2
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Use docker-container driver to allow useful features (push/multi-platform)
- update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
script:
- docker buildx ls
- docker buildx build --platform $CI_BUILD_ARCHS --progress plain --pull -t "$CI_REGISTRY_IMAGE" --push .
```
And the (partial) output:
```
#6 [linux/amd64 2/2] RUN echo "Hello, my CPU architecture is $(uname -m)"
#6 0.120 Hello, my CPU architecture is x86_64
#6 DONE 0.3s
#8 [linux/arm/v7 2/2] RUN echo "Hello, my CPU architecture is $(uname -m)"
#8 0.233 Hello, my CPU architecture is armv7l
#8 DONE 0.2s
```
</details>

1
gitlab-ci Submodule

Submodule gitlab-ci added at 18a2808787

View File

@ -1,46 +0,0 @@
image: jonoh/docker-buildx-qemu
variables:
DOCKER_HOST: tcp://docker:2375/
PLATFORM: local
DOCKER_IMAGE_TAG: latest
DOCKER_PREBUILD_CMD: echo
services:
- docker:dind
.docker_before_script: &docker_before_script
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull "$CI_REGISTRY_IMAGE" || true
- '[[ "$PLATFORM" != "local" ]] && update-binfmts --enable'
# Use docker-container driver to allow useful features (push/multi-platform)
- docker buildx create --driver docker-container --use
- docker buildx inspect --bootstrap
build:
stage: build
before_script: *docker_before_script
script:
- $DOCKER_PREBUILD_CMD
- docker buildx build
--pull
--cache-from "$CI_REGISTRY_IMAGE"
--platform "$PLATFORM"
-t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
--push $EXTRA_BUILD_ARGS .
only:
- master
build-unstable:
stage: build
before_script: *docker_before_script
script:
- $DOCKER_PREBUILD_CMD
- docker buildx build
--pull
--cache-from "$CI_REGISTRY_IMAGE"
--platform "$PLATFORM"
-t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
--push $EXTRA_BUILD_ARGS .
except:
- master