Docker container's entrypoint ignored/overriden in GitHub Actions

I’m trying to port a GitLab Pipeline to GitHub Actions, where we use Docker containers to provide the runtime environment. In GitLab, we simply use a line image: $DOCKER_TAG. The images are built by ourselves, which use a script as the entry point ENTRYPOINT ["/"]. The script sets up environment (e.g., by sourcing the script for the Intel compilers and calling ulimit -s unlimited, etc.) and calls exec "$@" at the end. For GitHub, I am using

  image: ${{ matrix.DOCKER_TAG }}

However, the commands to be run later cannot find the needed binaries. Looking at the log, it appears that the container was created with --entrypoint "tail", causing the script to be ignored. I tried adding options: --entrypoint '/' in the Workflow YAML file, but it did not get reflected in how the container was created and the command still failed.

I may be missing something obvious, though I checked both the documentation and Google. Is there any way to use the entrypoint provided by the image without creating a Docker container action?

1 Like

Two more things I tried:

  1. Specifying the / script as Custom shell: shell: '/ {0}', but got an error
Error: Second path fragment must not be a drive or UNC name. (Parameter 'expression')
  1. Using Docker container action or specifying a Docker image to use for a job step. But in both cases the Docker image has to be hard coded (or built fresh every time). Trying to use input arguments like
# Docker container action
image: docker://${{ inputs.docker_tag }}


# Job step
- uses: docker://${{ matrix.DOCKER_TAG }}
    args: ./.github/actions/build/

will both get an error

Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.docker_tag

I’ve settled along the lines below. Not ideal/DRY, as the entrypoint script has to be duplicated from the Docker container and kept up to date. Also, the upload-artifact GitHub Actions does not preserve executable bits, so have to zip everything in a tar file.

      image: XX/compiler:${{ matrix.DOCKER_TAG }}
    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
      - run: ./.github/scripts/ ./.github/scripts/
      - uses: actions/upload-artifact@v2
          name: build-artifact
          path: 'build-*.tar.bz2'
          retention-days: 7
      fail-fast: false
        DOCKER_TAG: [gcc, nvhpc, intel]
          - DOCKER_TAG: gcc
            FC: gfortran
          - DOCKER_TAG: nvhpc
            FC: nvfortran
          - DOCKER_TAG: intel
            FC: ifort