Add usage of strict shell (#1841)
Co-authored-by: Rico Sta. Cruz <rstacruz@users.noreply.github.com>
This commit is contained in:
parent
b50655f6dc
commit
5b68e050e0
|
@ -47,6 +47,20 @@ ADD file.xyz /file.xyz
|
||||||
COPY --chown=user:group host_file.xyz /path/container_file.xyz
|
COPY --chown=user:group host_file.xyz /path/container_file.xyz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Run commands in strict shell
|
||||||
|
|
||||||
|
```docker
|
||||||
|
ENV my_var
|
||||||
|
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||||
|
|
||||||
|
# With strict mode:
|
||||||
|
RUN false # fails build like using &&
|
||||||
|
RUN echo "$myvar" # will throw error due to typo
|
||||||
|
RUN true | false # will bail out of pipe
|
||||||
|
```
|
||||||
|
|
||||||
|
Using `shell` will turn on strict mode for shell commands.
|
||||||
|
|
||||||
### Onbuild
|
### Onbuild
|
||||||
|
|
||||||
```docker
|
```docker
|
||||||
|
|
Loading…
Reference in New Issue