From 4cd31b6b200318df0cd4a660d0f1f1eeda72e32e Mon Sep 17 00:00:00 2001 From: Nikola Jokic <97525037+nikola-jokic@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:11:31 +0100 Subject: [PATCH 1/2] Added explanation about workdir override in entrypoint Issue describing the problem: https://github.com/actions/runner/issues/1088 --- .../dockerfile-support-for-github-actions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/actions/creating-actions/dockerfile-support-for-github-actions.md b/content/actions/creating-actions/dockerfile-support-for-github-actions.md index 58e2bf325b34..ad8ad0592e7c 100644 --- a/content/actions/creating-actions/dockerfile-support-for-github-actions.md +++ b/content/actions/creating-actions/dockerfile-support-for-github-actions.md @@ -47,6 +47,12 @@ If you define `entrypoint` in an action's metadata file, it will override the `E The Docker `ENTRYPOINT` instruction has a _shell_ form and _exec_ form. The Docker `ENTRYPOINT` documentation recommends using the _exec_ form of the `ENTRYPOINT` instruction. For more information about _exec_ and _shell_ form, see the [ENTRYPOINT reference](https://docs.docker.com/engine/reference/builder/#entrypoint) in the Docker documentation. +{% warning %} + +**Warning:** If you are using `WORKDIR` inside your Dockerfile, when specifying a path to your `entrypoint`, use the absolute path. The `WORKDIR` override will change the present working directory to `/github/workspace`, but the previous steps would be using the `WORKDIR` you specified in a Dockerfile. + +{% endwarning %} + If you configure your container to use the _exec_ form of the `ENTRYPOINT` instruction, the `args` configured in the action's metadata file won't run in a command shell. If the action's `args` contain an environment variable, the variable will not be substituted. For example, using the following _exec_ format will not print the value stored in `$GITHUB_SHA`, but will instead print `"$GITHUB_SHA"`. ```dockerfile From d71e158a889a3b106216aa13f713387b95478eb8 Mon Sep 17 00:00:00 2001 From: Nikola Jokic <97525037+nikola-jokic@users.noreply.github.com> Date: Tue, 1 Feb 2022 09:24:35 +0100 Subject: [PATCH 2/2] Update content/actions/creating-actions/dockerfile-support-for-github-actions.md Co-authored-by: Sarah Edwards --- .../dockerfile-support-for-github-actions.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/content/actions/creating-actions/dockerfile-support-for-github-actions.md b/content/actions/creating-actions/dockerfile-support-for-github-actions.md index ad8ad0592e7c..7ae433e08b09 100644 --- a/content/actions/creating-actions/dockerfile-support-for-github-actions.md +++ b/content/actions/creating-actions/dockerfile-support-for-github-actions.md @@ -47,11 +47,7 @@ If you define `entrypoint` in an action's metadata file, it will override the `E The Docker `ENTRYPOINT` instruction has a _shell_ form and _exec_ form. The Docker `ENTRYPOINT` documentation recommends using the _exec_ form of the `ENTRYPOINT` instruction. For more information about _exec_ and _shell_ form, see the [ENTRYPOINT reference](https://docs.docker.com/engine/reference/builder/#entrypoint) in the Docker documentation. -{% warning %} - -**Warning:** If you are using `WORKDIR` inside your Dockerfile, when specifying a path to your `entrypoint`, use the absolute path. The `WORKDIR` override will change the present working directory to `/github/workspace`, but the previous steps would be using the `WORKDIR` you specified in a Dockerfile. - -{% endwarning %} +You should not use `WORKDIR` to specify your entrypoint in your Dockerfile. Instead, you should use an absolute path. For more information, see [WORKDIR](#workdir). If you configure your container to use the _exec_ form of the `ENTRYPOINT` instruction, the `args` configured in the action's metadata file won't run in a command shell. If the action's `args` contain an environment variable, the variable will not be substituted. For example, using the following _exec_ format will not print the value stored in `$GITHUB_SHA`, but will instead print `"$GITHUB_SHA"`.