https://github.com/waltertamboer/experiment-gitlab-ci-docker-image
A test to see how Gitlab CI reacts to docker images with an entry point.
https://github.com/waltertamboer/experiment-gitlab-ci-docker-image
ci docker entrypoint gitlab gitlab-ci image
Last synced: 10 months ago
JSON representation
A test to see how Gitlab CI reacts to docker images with an entry point.
- Host: GitHub
- URL: https://github.com/waltertamboer/experiment-gitlab-ci-docker-image
- Owner: waltertamboer
- License: mit
- Created: 2018-03-21T18:50:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-24T15:44:53.000Z (about 8 years ago)
- Last Synced: 2025-03-13T02:33:41.393Z (over 1 year ago)
- Topics: ci, docker, entrypoint, gitlab, gitlab-ci, image
- Language: Shell
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# experiment-gitlab-ci-docker-image
A test to see how Gitlab CI reacts to docker images with an
entry point.
## Problem
Gitlab CI starts overrides the entry point of a Docker image with
the following script:
```
sh -c if [ -x /usr/local/bin/bash ]; then
exec /usr/local/bin/bash
elif [ -x /usr/bin/bash ]; then
exec /usr/bin/bash
elif [ -x /bin/bash ]; then
exec /bin/bash
elif [ -x /usr/local/bin/sh ]; then
exec /usr/local/bin/sh
elif [ -x /usr/bin/sh ]; then
exec /usr/bin/sh
elif [ -x /bin/sh ]; then
exec /bin/sh
else
echo shell not found
exit 1
fi
```
This makes it impossible to run a container with a set entry
point such as `ENTRYPOINT ["composer"]`.
## Solution
The solution I found is based on `https://github.com/composer/docker/blob/master/docker-entrypoint.sh`.
The trick is to detect the incoming command and based on that
command differentiate the processing of it.
## Bonus
Use tini (https://github.com/krallin/tini) to initialize containers.
Tini spawns a single child and waits for it to exit all the while
reaping zombies and performing signal forwarding.