-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packaging: refactor docker image build
Makefile changes == Build local architecture binaries into build/ folder and nest other architecture-dependent binaries into build/<arch> subfolders (e.g. build/linux/amd64). Add help and make it a default target. Cleanup tar packages. Remove unused variables. Dockerfile changes == Remove BUILD_FOLDER build arg, see Makefile changes. Use COPY instead of ADD following https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy Remove redundant commands. Use one Docker file for all architectures. Use alpine:latest in Dockerfile and configure trusted base images for amd64 and multiarch builds in Makefile. Testing == Using https://github.com/multiarch/qemu-user-static it is possible to test that all make targets produce images and binaries for proper architectures, see `make test` Links == * https://www.docker.com/blog/multi-arch-images/ * https://www.thorsten-hans.com/how-to-build-multi-arch-docker-images-with-ease/ * https://www.stereolabs.com/docs/docker/building-arm-container-on-x86/ * https://github.com/multiarch/qemu-user-static * https://stackoverflow.com/questions/72444103/what-does-running-the-multiarch-qemu-user-static-does-before-building-a-containe Signed-off-by: Alexander Yastrebov <[email protected]>
- Loading branch information
1 parent
239a5b3
commit 785678b
Showing
5 changed files
with
86 additions
and
90 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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
ARG BASE_IMAGE=default | ||
FROM registry.opensource.zalan.do/library/alpine-3:latest AS default | ||
FROM alpine:latest AS default | ||
FROM ${BASE_IMAGE} | ||
LABEL maintainer="Team Gateway&Proxy @ Zalando SE <[email protected]>" | ||
RUN apk --no-cache add ca-certificates && update-ca-certificates | ||
RUN mkdir -p /usr/bin | ||
ARG BUILD_FOLDER=build | ||
|
||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope | ||
ARG TARGETPLATFORM | ||
ADD ${BUILD_FOLDER}/${TARGETPLATFORM}/skipper \ | ||
${BUILD_FOLDER}/${TARGETPLATFORM}/eskip \ | ||
${BUILD_FOLDER}/${TARGETPLATFORM}/webhook \ | ||
${BUILD_FOLDER}/${TARGETPLATFORM}/routesrv /usr/bin/ | ||
ENV PATH $PATH:/usr/bin | ||
|
||
RUN apk --no-cache add ca-certificates && update-ca-certificates | ||
|
||
COPY build/${TARGETPLATFORM}/skipper \ | ||
build/${TARGETPLATFORM}/eskip \ | ||
build/${TARGETPLATFORM}/webhook \ | ||
build/${TARGETPLATFORM}/routesrv \ | ||
/usr/bin/ | ||
|
||
EXPOSE 9090 9911 | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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