Build docker image from artifact

Hello I’ve been trying to build a docker image for hours and while I fix a few issues, I am (I think) really close to a working state.

Here’s my CI:

release:
  stage: release
  before_script:
    *setup
  variables:
    MIX_ENV: "prod"
  script:
    - mix release
  artifacts:
    paths:
      - _build
    untracked: true

# reminder: it it's the runner to run with privileged=true
docker:
  image: docker:19.03
  stage: docker
  dependencies:
    - release
  services:
    - name: docker:19.03-dind
      alias: docker
  variables:
    IMAGE_TAG: prezance_api:$CI_COMMIT_SHORT_SHA
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build -t $IMAGE_TAG .
    - docker push $IMAGE_TAG

The release stage works and provide an artifact with _build/ folder. But the _build/ folder is not available on the docker stage. I first tried with 19.03.12 but I read there is some mounting to do https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-in-docker-workflow-with-docker-executor) so I downgraded image to 19.03 and still no luck.

Am I missing something?

I may found a clue:

Preparing environment
Running on runner-rpzygsk9-project-2-concurrent-0 via ns3302310...
Getting source from Git repository
00:03
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/gitlab-instance-b24beb41/prezance-api/.git/
Checking out a7e44eac as master...
Removing _build/
Removing deps/
Skipping Git submodules setup
Downloading artifacts
Downloading artifacts for release (1329)...
Downloading artifacts from coordinator... ok        id=1329 responseStatus=200 OK token=YJUZ6uAS
Executing "step_script" stage of the job script
$ docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

I see it’s trying to remove _build (maybe it’s because it’s also used in another stage?)

I removed the “dependencies” from docker stage and still have the same “removing _build/” message, and still no _build/ folder inside the docker stage.

COPY failed: stat /var/lib/docker/tmp/docker-builder146002122/_build/prod/rel/prezance_api: no such file or directory

Sorry it looks like an issue with my Dockerfile and not from the runner