jhipster-control-center icon indicating copy to clipboard operation
jhipster-control-center copied to clipboard

Provide docker images compatible with apple M1

Open vwiencek opened this issue 3 years ago • 1 comments

I guess docker automatically build image for linux/amd64 platform

Would that be possible to build images for arm platforms ?

I guess we should do it by adding some CI script to the current Dockerfile

Below is an example from my gitlab CI script for my projects

build-service:
  stage: deploy
  image: docker:dind
  variables:
      PLATFORMS: "linux/arm64,linux/amd64"
  script:
    - apt-get install -y curl jq
    - mkdir -p ~/.docker/cli-plugins/
    - BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/latest | grep 'linux-amd64' | grep 'href' | sed 's/.*href="/https:\/\/github.com/g; s/amd64".*/amd64/g')
    - curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
    - chmod a+x ~/.docker/cli-plugins/docker-buildx
    - BINFMT_IMAGE_TAG=$(curl -s https://registry.hub.docker.com/v2/repositories/docker/binfmt/tags | jq '.results | sort_by(.last_updated)[-1].name' -r)
    - docker run --rm --privileged docker/binfmt:${BINFMT_IMAGE_TAG}
    - git clone https://github.com/my_repo.git
    - docker buildx create --name multibuilder 
    - docker buildx use multibuilder
    - docker buildx build --platform "${PLATFORMS}" --tag $IMAGE_TAG --build-arg ci_job_token=$CI_JOB_TOKEN  . --push
  only:
    - master

The purpose here is to choose platforms for which the image should be built.

Is that something feasible with current jhipster CI framework ?

vwiencek avatar Jun 13 '21 08:06 vwiencek

The build of Docker image is done by Docker Hub. All we needed is a new Dockerfile, so I can try to param another Docker image, with specific tag for that.

pascalgrimaud avatar Jun 16 '21 13:06 pascalgrimaud