Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle [Snyk] Security upgrade debian from 9.5-slim to stretch-20211201-slim #116

Open
wants to merge 1 commit into
base: snyk-fix-1a6bc62d24370f2b0d14ad7578ef4e87
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Dockerfile support for GitHub Actions
shortTitle: Docker
intro: 'When creating a `Dockerfile` for a Docker container action, you should be aware of how some Docker instructions interact with GitHub Actions and an action''s metadata file.'
product: '{% data reusables.gated-features.actions %}'
intro: "When creating a `Dockerfile` for a Docker container action, you should be aware of how some Docker instructions interact with GitHub Actions and an action's metadata file."
product: "{% data reusables.gated-features.actions %}"
redirect_from:
- /actions/building-actions/dockerfile-support-for-github-actions
versions:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'reference'
free-pro-team: "*"
enterprise-server: ">=2.22"
github-ae: "*"
type: "reference"
---

{% data reusables.actions.enterprise-beta %}
Expand Down Expand Up @@ -54,15 +54,15 @@ If you configure your container to use the _exec_ form of the `ENTRYPOINT` instr
ENTRYPOINT ["echo $GITHUB_SHA"]
```

If you want variable substitution, then either use the _shell_ form or execute a shell directly. For example, using the following _exec_ format, you can execute a shell to print the value stored in the `GITHUB_SHA` environment variable.
If you want variable substitution, then either use the _shell_ form or execute a shell directly. For example, using the following _exec_ format, you can execute a shell to print the value stored in the `GITHUB_SHA` environment variable.

```dockerfile
ENTRYPOINT ["sh", "-c", "echo $GITHUB_SHA"]
```

To supply `args` defined in the action's metadata file to a Docker container that uses the _exec_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction:
To supply `args` defined in the action's metadata file to a Docker container that uses the _exec_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction:

##### Example *Dockerfile*
##### Example _Dockerfile_

```dockerfile
# Container image that runs your code
Expand All @@ -75,11 +75,11 @@ COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
```

##### Example *entrypoint.sh* file
##### Example _entrypoint.sh_ file

Using the example Dockerfile above, {% data variables.product.product_name %} will send the `args` configured in the action's metadata file as arguments to `entrypoint.sh`. Add the `#!/bin/sh` [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) at the top of the `entrypoint.sh` file to explicitly use the system's [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant shell.
Using the example Dockerfile above, {% data variables.product.product_name %} will send the `args` configured in the action's metadata file as arguments to `entrypoint.sh`. Add the `#!/bin/sh` [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) at the top of the `entrypoint.sh` file to explicitly use the system's [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant shell.

``` sh
```sh
#!/bin/sh

# `$*` expands the `args` supplied in an `array` individually
Expand All @@ -88,13 +88,14 @@ sh -c "echo $*"
```

Your code must be executable. Make sure the `entrypoint.sh` file has `execute` permissions before using it in a workflow. You can modify the permission from your terminal using this command:
``` sh
chmod +x entrypoint.sh
```

```sh
chmod +x entrypoint.sh
```

When an `ENTRYPOINT` shell script is not executable, you'll receive an error similar to this:

``` sh
```sh
Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/entrypoint.sh\": permission denied": unknown
```

Expand Down