make entrypoint optional
Some checks failed
run tests / run-container (push) Failing after 6s

This commit is contained in:
Ivan Schaller 2023-08-16 12:10:20 +02:00
parent f63602e5f4
commit e30de98e6a
Signed by: olofvndrhr
GPG key ID: 2A6BE07D99C8C205
3 changed files with 10 additions and 6 deletions

View file

@ -21,7 +21,7 @@ jobs:
image: debian:11-slim image: debian:11-slim
volumes: /tmp/:/tmp/ volumes: /tmp/:/tmp/
options: -e TESTENV=${{ gitea.workspace }} options: -e TESTENV=${{ gitea.workspace }}
run: echo "test" run: env; echo "test"
- name: multi-line options - name: multi-line options
uses: https://git.44net.ch/actions/docker-run-action@main uses: https://git.44net.ch/actions/docker-run-action@main
@ -35,5 +35,6 @@ jobs:
-e TESTENV=${{ gitea.workspace }} -e TESTENV=${{ gitea.workspace }}
-e TESTENV2=TESTENV2 -e TESTENV2=TESTENV2
run: >- run: >-
env;
sh -c sh -c
echo "test echo "test"

View file

@ -28,10 +28,9 @@ inputs:
description: "Command(s) to run in the container" description: "Command(s) to run in the container"
required: false required: false
shell: entrypoint:
description: "Shell to use" description: "Entrypoint for the container"
required: false required: false
default: sh
registry: registry:
description: "Container registry URL" description: "Container registry URL"

View file

@ -28,6 +28,11 @@ if [ "${INPUT_MOUNT_SOCKET,,}" == "true" ]; then
RUNTIME_OPTIONS+=(--volume "/var/run/docker.sock:/var/run/docker.sock") RUNTIME_OPTIONS+=(--volume "/var/run/docker.sock:/var/run/docker.sock")
fi fi
# set entrypoint
if [ "${INPUT_ENTRYPOINT,,}" == "true" ]; then
RUNTIME_OPTIONS+=(--entrypoint="${INPUT_ENTRYPOINT}")
fi
# map volumes # map volumes
mapfile -t -d ' ' TMP_VOLUMES < <(printf -- '%s' "${INPUT_VOLUMES}") mapfile -t -d ' ' TMP_VOLUMES < <(printf -- '%s' "${INPUT_VOLUMES}")
for vol in "${TMP_VOLUMES[@]}"; do for vol in "${TMP_VOLUMES[@]}"; do
@ -49,7 +54,6 @@ done
exec docker run \ exec docker run \
--volume "${INPUT_WORKDIR}:${INPUT_WORKDIR}" \ --volume "${INPUT_WORKDIR}:${INPUT_WORKDIR}" \
--workdir "${INPUT_WORKDIR}" \ --workdir "${INPUT_WORKDIR}" \
--entrypoint="${INPUT_SHELL}" \
--env-file "/docker-run-action.env" \ --env-file "/docker-run-action.env" \
"${RUNTIME_OPTIONS[@]}" \ "${RUNTIME_OPTIONS[@]}" \
"${CUSTOM_OPTIONS[@]}" \ "${CUSTOM_OPTIONS[@]}" \