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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The IMAGE_ARG_* mechanism doesn't work with multi-arch builds #110

Open
imsodin opened this issue Jan 17, 2023 · 0 comments
Open

The IMAGE_ARG_* mechanism doesn't work with multi-arch builds #110

imsodin opened this issue Jan 17, 2023 · 0 comments

Comments

@imsodin
Copy link

imsodin commented Jan 17, 2023

I am successfully using the multi-arch capabilities to build images for both amd64 and arm64, however not when using an image obtained through registry-image with IMAGE_ARG_* as introduced in #52 (we need it as the image is in ECR/private). It apparently uses the host arch for the base image regardless of target arch.

Small reproducer. For good measure I use oci-build-image from master tag, currently 1aac28e to get the latest buildkit updates - same result with v0.11.0:

Dockerfile:

ARG from_image=golang:1.19.5-alpine3.16
FROM ${from_image}

RUN echo test

Pipeline:

resource_types:
  - name: registry-image
    type: registry-image
    source:
      repository: "concourse/registry-image-resource"
      tag: 1.7.1

resources:
  - name: repo
    type: git
    icon: github-circle
    webhook_token: ((github_webhook.token))
    source:
      uri: https://github.com/nsat/maritime-go-bootstrap.git
      username: ((github.github_bot_username))
      password: ((github.github_bot_password))
      branch: MARITIME-1334-docker-from-image
      paths:
        - build/test
        - pipeline/task/build-docker-dualarch.yaml

  - name: from-image
    type: registry-image
    icon: docker
    source:
      repository: golang
      tag: 1.19.3-alpine3.16

jobs:
  - name: release-image
    plan:
      - in_parallel:
        - get: repo
          trigger: true
        - get: from-image
          params:
            format: oci

      - task: docker-build
        privileged: true
        config:
          platform: linux
          image_resource:
            type: registry-image
            source:
              repository: concourse/oci-build-task
              tag: master
          inputs:
            - name: repo
            - name: from-image
              optional: true
          outputs:
            - name: image
          caches:
            - path: cache
          params:
            CONTEXT: repo/build/test
            IMAGE_ARG_from_image: from-image/image.tar
            IMAGE_PLATFORM: linux/amd64,linux/arm64
            OUTPUT_OCI: true
          run:
            path: build

Relevant output:

#9 [linux/arm64 2/2] RUN echo test

#0 0.084 .buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture

#9 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c echo test" did not complete successfully: exit code: 255

------

 > [linux/arm64 2/2] RUN echo test:

#0 0.084 .buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture

If I remove the parts about IMAGE_ARG_*, it just works.

Tagging @vito as the author of #52 and @rdrgmnzs as the author of multi-arch support (567071e).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant