Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Dockerfile for cross compilation (test Jenkinsfile changes) #43613

Closed
wants to merge 26 commits into from

Commits on Aug 20, 2022

  1. Dockerfile: use TARGETPLATFORM with scopeo for frozen images stage

    frozen-images stage doesn't use the download-frozen-image-v2.sh
    anymore so we can effectively use TARGETPLATFORM from global scope.
    The test util has been updated accordingly.
    
    In a follow-up we can remove download-frozen-image-v2.sh script but
    needs to look first at Dockerfile.e2e which seems not used anymore
    in our pipeline.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    5bede30 View commit details
    Browse the repository at this point in the history
  2. Dockerfile: handle multi base image for riscv64 and armel support

    To add support for riscv64 builds we need crossbuild packages for
    riscv64 but current golang image with debian bullseye does not
    support it. Ubuntu 22.04 supports riscv64 but unfortunately drops
    support for armel arch. Therefore we need a multi base image that
    will be picked up based on the target platform we want to build.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    3d58373 View commit details
    Browse the repository at this point in the history
  3. Dockerfile: remove hardcoded platform for vpnkit stage

    vpnkit stage only supports linux/amd64 and linux/arm64
    platforms when building dev image and will crash if we
    try building against another platform.
    
    with this change we can still build the dev image
    against any platform using dummy scratch base.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    f6cccc7 View commit details
    Browse the repository at this point in the history
  4. Dockerfile: add cross compilation helper

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    cbe9d62 View commit details
    Browse the repository at this point in the history
  5. Dockerfile: pin criu version and build from source

    pin criu for better reproducibility and build from
    source so we can use it across any platform.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    27831cd View commit details
    Browse the repository at this point in the history
  6. Dockerfile: add dummy stage

    dummy stage allows to bypass build for deps that
    don't support some platforms
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    94a1e3e View commit details
    Browse the repository at this point in the history
  7. Dockerfile: containerd cross

    containerd build in Dockerfile is limited to
    host platform and could not be cross-built
    for other platforms.
    
    this change allows to build against any platforms
    if we want to smoke test in a follow-up but also
    enhance e2e tests for linux and windows in our
    pipeline.
    
    also introduced DOCKER_LINKMODE to be able to
    build dynamic or static binaries.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    e14fc4f View commit details
    Browse the repository at this point in the history
  8. Dockerfile: runc cross

    runc build in Dockerfile is limited to host
    platform and could not be cross-built for
    other platforms.
    
    this change allows to build against any platforms
    if we want to smoke test in a follow-up but also
    enhance e2e tests for linux and windows in our
    pipeline.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    97b3b09 View commit details
    Browse the repository at this point in the history
  9. Dockerfile: tini cross

    tini build in Dockerfile is limited to host
    platform and could not be cross-built for
    other platforms.
    
    this change allows to build against any platforms
    if we want to smoke test in a follow-up but also
    enhance e2e tests for linux and windows in our
    pipeline.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    1e3d1eb View commit details
    Browse the repository at this point in the history
  10. Dockerfile: rootlesskit cross

    rootlesskit build in Dockerfile is limited to host
    platform and could not be cross-built for
    other platforms.
    
    this change allows to build against any platforms
    if we want to smoke test in a follow-up but also
    enhance e2e tests for linux and windows in our
    pipeline.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    28ea210 View commit details
    Browse the repository at this point in the history
  11. Dockerfile: containerutility cross

    containerutility build in Dockerfile is limited to
    windows platform atm but enabling cross build for
    it enhance and reduce footprint in our piepline
    for linux and windows e2e tests.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    39e131d View commit details
    Browse the repository at this point in the history
  12. Dockerfile: verify and better cache for go-swagger stage

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    3fbcb7e View commit details
    Browse the repository at this point in the history
  13. Dockerfile: align deps format and output

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    32b446b View commit details
    Browse the repository at this point in the history
  14. Dockerfile: use TARGETPLATFORM for delve stage and verify

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    1e13269 View commit details
    Browse the repository at this point in the history
  15. Dockerfile: verify and better cache for dockercli stage

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    03cb6ce View commit details
    Browse the repository at this point in the history
  16. Dockerfile: use global scope platform args for registry stage and verify

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    0924ec1 View commit details
    Browse the repository at this point in the history
  17. Dockerfile: better cache for crun stage

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    385502e View commit details
    Browse the repository at this point in the history
  18. Dockerfile: GO111MODULE=on by default

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    f045cf8 View commit details
    Browse the repository at this point in the history
  19. Dockerfile: enhanced for cross compilation

    Better support for cross compilation so we can rely
    on --platform flag of buildx for a seamless integration.
    
    This removes not necessary extra cross logic in the Dockerfile
    as well as hack scripts.
    
    Tried my best to reduce the footprint of changes but modifying
    one bit in the Dockerfile involves other changes in ./hack
    scripts. Non-sandboxed build invocation is still supported.
    
    It also handles cross compilation for external tools dynamically
    based on platform arg available in global scope (containerd,
    runc, tini, ...).
    
    Dev stages have been updated accordingly to changes for cross
    comp as well as linked tools (swagger, tomll, gotestsum, ...)
    
    The current bake definition has been updated to take the changes
    into account as well as the ci gha workflow.
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    0c99378 View commit details
    Browse the repository at this point in the history
  20. Dockerfile: add "all" stage to build binaries and extra tools

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    0bf53ff View commit details
    Browse the repository at this point in the history
  21. ci: add job to test building dev image

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    454233a View commit details
    Browse the repository at this point in the history
  22. Jenkinsfile: remove cross stage (moved to gha)

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    7517f97 View commit details
    Browse the repository at this point in the history
  23. Dockerfile: smoke test stage and gha workflow

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    55ef5ec View commit details
    Browse the repository at this point in the history
  24. Dockerfile: refactor Dockerfile.simple and create gha workflow

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    f87e91b View commit details
    Browse the repository at this point in the history
  25. riscv64 support

    needs to update supported platforms for pie buildmode
    and adds smoke test
    
    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    c9c4bf7 View commit details
    Browse the repository at this point in the history
  26. docs: contributing docs update for cross comp

    Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
    crazy-max committed Aug 20, 2022
    Configuration menu
    Copy the full SHA
    01ca536 View commit details
    Browse the repository at this point in the history