This cross-compiling other binaries simpler.
It would be nice if the cross Makefile target built all the required
bins, but at least this is a first step.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -94,16 +94,28 @@ RUN /download-frozen-image-v2.sh /build \ |
| 94 | 94 |
hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c |
| 95 | 95 |
# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list) |
| 96 | 96 |
|
| 97 |
-# Just a little hack so we don't have to install these deps twice, once for runc and once for dockerd |
|
| 98 |
-FROM base AS runtime-dev-cross-false |
|
| 99 |
-RUN apt-get update && apt-get install -y \ |
|
| 100 |
- libapparmor-dev \ |
|
| 101 |
- libseccomp-dev |
|
| 97 |
+FROM base AS cross-false |
|
| 102 | 98 |
|
| 103 |
-FROM runtime-dev-cross-false AS runtime-dev-cross-true |
|
| 99 |
+FROM base AS cross-true |
|
| 104 | 100 |
RUN dpkg --add-architecture armhf |
| 105 | 101 |
RUN dpkg --add-architecture arm64 |
| 106 | 102 |
RUN dpkg --add-architecture armel |
| 103 |
+RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \ |
|
| 104 |
+ apt-get update \ |
|
| 105 |
+ && apt-get install -y --no-install-recommends \ |
|
| 106 |
+ crossbuild-essential-armhf \ |
|
| 107 |
+ crossbuild-essential-arm64 \ |
|
| 108 |
+ crossbuild-essential-armel; \ |
|
| 109 |
+ fi |
|
| 110 |
+ |
|
| 111 |
+FROM cross-${CROSS} as dev-base
|
|
| 112 |
+ |
|
| 113 |
+FROM dev-base AS runtime-dev-cross-false |
|
| 114 |
+RUN apt-get update && apt-get install -y \ |
|
| 115 |
+ libapparmor-dev \ |
|
| 116 |
+ libseccomp-dev |
|
| 117 |
+ |
|
| 118 |
+FROM cross-true AS runtime-dev-cross-true |
|
| 107 | 119 |
# These crossbuild packages rely on gcc-<arch>, but this doesn't want to install |
| 108 | 120 |
# on non-amd64 systems. |
| 109 | 121 |
# Additionally, the crossbuild-amd64 is currently only on debian:buster, so |
| ... | ... |
@@ -111,12 +123,16 @@ RUN dpkg --add-architecture armel |
| 111 | 111 |
RUN if [ "$(go env GOHOSTARCH)" = "amd64" ]; then \ |
| 112 | 112 |
apt-get update \ |
| 113 | 113 |
&& apt-get install -y \ |
| 114 |
- crossbuild-essential-armhf \ |
|
| 115 |
- crossbuild-essential-arm64 \ |
|
| 116 |
- crossbuild-essential-armel \ |
|
| 117 | 114 |
libseccomp-dev:armhf \ |
| 118 | 115 |
libseccomp-dev:arm64 \ |
| 119 |
- libseccomp-dev:armel; \ |
|
| 116 |
+ libseccomp-dev:armel \ |
|
| 117 |
+ libapparmor-dev:armhf \ |
|
| 118 |
+ libapparmor-dev:arm64 \ |
|
| 119 |
+ libapparmor-dev:armel \ |
|
| 120 |
+ # install this arches seccomp here due to compat issues with the v0 builder |
|
| 121 |
+ # This is as opposed to inheriting from runtime-dev-cross-false |
|
| 122 |
+ libapparmor-dev \ |
|
| 123 |
+ libseccomp-dev; \ |
|
| 120 | 124 |
fi |
| 121 | 125 |
|
| 122 | 126 |
FROM runtime-dev-cross-${CROSS} AS runtime-dev
|
| ... | ... |
@@ -133,14 +149,14 @@ COPY hack/dockerfile/install/install.sh ./install.sh |
| 133 | 133 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| 134 | 134 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
| 135 | 135 |
|
| 136 |
-FROM base AS containerd |
|
| 136 |
+FROM dev-base AS containerd |
|
| 137 | 137 |
RUN apt-get update && apt-get install -y btrfs-tools |
| 138 | 138 |
ENV INSTALL_BINARY_NAME=containerd |
| 139 | 139 |
COPY hack/dockerfile/install/install.sh ./install.sh |
| 140 | 140 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| 141 | 141 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
| 142 | 142 |
|
| 143 |
-FROM base AS proxy |
|
| 143 |
+FROM dev-base AS proxy |
|
| 144 | 144 |
ENV INSTALL_BINARY_NAME=proxy |
| 145 | 145 |
COPY hack/dockerfile/install/install.sh ./install.sh |
| 146 | 146 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| ... | ... |
@@ -152,7 +168,7 @@ COPY hack/dockerfile/install/install.sh ./install.sh |
| 152 | 152 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| 153 | 153 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
| 154 | 154 |
|
| 155 |
-FROM base AS dockercli |
|
| 155 |
+FROM dev-base AS dockercli |
|
| 156 | 156 |
ENV INSTALL_BINARY_NAME=dockercli |
| 157 | 157 |
COPY hack/dockerfile/install/install.sh ./install.sh |
| 158 | 158 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| ... | ... |
@@ -164,14 +180,14 @@ COPY hack/dockerfile/install/install.sh ./install.sh |
| 164 | 164 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| 165 | 165 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
| 166 | 166 |
|
| 167 |
-FROM base AS tini |
|
| 167 |
+FROM dev-base AS tini |
|
| 168 | 168 |
RUN apt-get update && apt-get install -y cmake vim-common |
| 169 | 169 |
COPY hack/dockerfile/install/install.sh ./install.sh |
| 170 | 170 |
ENV INSTALL_BINARY_NAME=tini |
| 171 | 171 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |
| 172 | 172 |
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME |
| 173 | 173 |
|
| 174 |
-FROM base AS rootlesskit |
|
| 174 |
+FROM dev-base AS rootlesskit |
|
| 175 | 175 |
ENV INSTALL_BINARY_NAME=rootlesskit |
| 176 | 176 |
COPY hack/dockerfile/install/install.sh ./install.sh |
| 177 | 177 |
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./ |