Support for building images locally

This commit is contained in:
Paolo Bosetti 2022-12-16 16:07:56 +01:00
parent fd49c088eb
commit 0d31400b97
45 changed files with 107 additions and 43 deletions

View File

@ -127,7 +127,8 @@ Then you must create a file named `Dockerfile.in` in the image folder (`linux-ar
Copy text to `Dockerfile.in` file: Copy text to `Dockerfile.in` file:
```docker ```docker
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -247,6 +247,7 @@ $(STANDARD_IMAGES): %: %/Dockerfile base
mkdir -p $@/imagefiles && cp -r imagefiles $@/ mkdir -p $@/imagefiles && cp -r imagefiles $@/
$(DOCKER) build -t $(ORG)/$@:latest \ $(DOCKER) build -t $(ORG)/$@:latest \
-t $(ORG)/$@:$(TAG) \ -t $(ORG)/$@:$(TAG) \
--build-arg ORG=$(ORG) \
--build-arg IMAGE=$(ORG)/$@ \ --build-arg IMAGE=$(ORG)/$@ \
--build-arg VERSION=$(TAG) \ --build-arg VERSION=$(TAG) \
--build-arg VCS_REF=`git rev-parse --short HEAD` \ --build-arg VCS_REF=`git rev-parse --short HEAD` \

View File

@ -565,6 +565,26 @@ The key difference is that [dockbuild](https://github.com/dockbuild/dockbuild#re
**dockcross** is used to build binaries for many different platforms. **dockcross** performs a cross compilation where the host build system is a Linux x86_64 / amd64 Docker image (so that it can be used for building binaries on any system which can run Docker images) and the target runtime system varies. **dockcross** is used to build binaries for many different platforms. **dockcross** performs a cross compilation where the host build system is a Linux x86_64 / amd64 Docker image (so that it can be used for building binaries on any system which can run Docker images) and the target runtime system varies.
## Build images by yourself
Perbuilt images available on Docker hub are single architecture amd64 images. Those images work evan on different architectures: for example, if you run a dockcross image on Docker running on an Apple M1, the image will run in emulation mode, meaning that it will still work as expected, although it will be slower than running on native hardware (you can expect a factor or 10 or more).
To overcome this limitation, you can build your own images on non-amd64 architectures. To do so, you can use the `Makefile` provided in this repository. For example, to build the `linux-armv7` image, and provided that your Docker hub organization name is `ACME`, you can run:
```bash
$ make ORG=ACME base
$ make ORG=ACME linux-armv7
```
This will create the Docker images `ACME/base` and `ACME/linux-armv7`, so that you can later launch a container using the `ACME/linux-armv7` image:
```
$ docker run --rm ACME/linux-armv7 uname -a
Linux 89b164ee8d90 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
```
Note that the architecture is now `aarch64` instead of `amd64`, so it runs natively on the Apple M1.
\-\-- \-\--
Credits: Credits:

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
MAINTAINER Matt McCormick "matt.mccormick@kitware.com" MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
# The cross-compiling emulator # The cross-compiling emulator

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
MAINTAINER Matt McCormick "matt.mccormick@kitware.com" MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
RUN \ RUN \
sed -i '/debian-security/d' /etc/apt/sources.list && \ sed -i '/debian-security/d' /etc/apt/sources.list && \

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Chen Tao t.clydechen@gmail.com" LABEL maintainer="Chen Tao t.clydechen@gmail.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
# This is for 64-bit ARM Linux machine (Ubuntu 18.04 or Debian 9 mini) # This is for 64-bit ARM Linux machine (Ubuntu 18.04 or Debian 9 mini)

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
ENV XCC_PREFIX /usr/xcc ENV XCC_PREFIX /usr/xcc
ENV CROSS_TRIPLE aarch64-linux-musl ENV CROSS_TRIPLE aarch64-linux-musl

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
ENV XCC_PREFIX /usr/xcc ENV XCC_PREFIX /usr/xcc
ENV CROSS_TRIPLE armv6-linux-musleabihf ENV CROSS_TRIPLE armv6-linux-musleabihf

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
ENV XCC_PREFIX /usr/xcc ENV XCC_PREFIX /usr/xcc
ENV CROSS_TRIPLE armv7l-linux-musleabihf ENV CROSS_TRIPLE armv7l-linux-musleabihf

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="PJ Reid PJ.Reid@Zetier.com" LABEL maintainer="PJ Reid PJ.Reid@Zetier.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"

View File

@ -1,4 +1,5 @@
FROM dockcross/base:latest ARG ORG=dockcross
FROM ${ORG}/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com" LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"