Issues with entrypoint and self-made build-containers in gitlab CI

I am using self-built docker build-images with a gitlab runner (docker executor) on a self-hosted gitlab instance.

The container must execute its source /etc/environment before executing any CI scripts to setup the env.

To achieve this automatically (I don’t want to source in the CI script), I setup the container’s entrypoint like this:

#!/usr/bin/env bash
# none of this seems to work...
source /etc/environment

if [ -n "$(echo $@)" ]; then
	/usr/bin/env bash -c $@
	/usr/bin/env /bin/bash

but apparently it has no effect. To troubleshoot this, it would help to know how the CI runs the container?

When I didn’t check for empty $@, I got an error saying bash -c needs a command, and with this entrypoint the CI starts but /etc/environment does not affect the CI’s env.

In /etc/environment I’m setting vars with export