This is the second project of openEuler hackathon game. This project is a tool to build the cross-platform docker images. At the moment, you can use this project to build an aarch64 docker image in the x86 platform without any modification of Dockerfile.
Prerequisites
This project is developed and tested in Huawei cloud server, and the OS is CentOS 7.6-x86_64. Docker daemon is required when the software is running. Docker 19.03.5 is recommended.
How to use it
Run sh prepare.sh to get qemu-aarch64-static and set binfmt_misc function.
Copy qemu-aarch64-static to the directory that you want to build a docker image.
Run go install to install the project.
You can run openEuler-image-cross-build pull imagename, openEuler-image-cross-build push imagename and openEuler-image-cross-build build -f dockerfilename -t imagetag directory like docker.
Example
The example folder is an example to use this project to build an aarch64 httpd image based on openEuler 1.0 OS image in x86_64 platform.
Run docker daemon and finish prepare work as How to use it chapter.
Run openEuler-image-cross-build pull huaxinlu/openeulergame2019:v3.1. This is a public image, so the username and password are empty.
Copy qemu-aarch64-static to the example folder and run openEuler-image-cross-build build -t httpd-openeuler-example example/ to build the image.
Because the binfmt_misc is set, you can test this image in host. Firstly, run the image using docker run -d -p 80:80 httpd-openeuler-example. Then run curl http://localhost:80, and "Hello World!" is printed in the screen.
You can also push image to your respository using openEuler-image-cross-build push tag/of/your/image. The username and password are needed during pushing.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.