Skip to content

Commit 03a57b6

Browse files
ekoopsirozzo-1A
authored andcommitted
chore(images): use bash as default and enable some safety options
In order to be sure that shell instructions in RUN steps run as intended, replace the default shell at build time with bash, enabling some safety options (`-euo pipefail`). At the moment, this is done only on rootfs images and builders. Signed-off-by: Leonardo Di Giovanna <[email protected]> Co-Authored-By: irozzo-1A <[email protected]>
1 parent cd9073c commit 03a57b6

File tree

32 files changed

+97
-4
lines changed

32 files changed

+97
-4
lines changed

images/aarch64/amazonlinux2/5.4/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM amazonlinux:2
33
ARG VERSION=5.4.247-162.350
44
ARG URL='http://amazonlinux.us-east-1.amazonaws.com/2/extras/kernel-5.4/latest/aarch64'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
RUN yum install -y \
710
binutils-devel \
811
chrony \

images/aarch64/amazonlinux2022/5.15/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ FROM amazonlinux:2022
33
ARG VERSION=5.15.73-45.135
44
ARG URL='https://al2022-repos-us-east-1-9761ab97.s3.dualstack.us-east-1.amazonaws.com/core/mirrors/latest/aarch64'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
68

79
RUN dnf groupinstall -y 'Development Tools' && \
810
dnf install -y \

images/aarch64/archlinux/4.14/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM lopsided/archlinux:latest
33
ARG VERSION=4.14.15-1
44
ARG URL='http://tardis.tiny-vps.com/aarm/packages'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
WORKDIR /home/ubuntu
710

811
RUN pacman -Syyu --noconfirm && \
@@ -32,4 +35,4 @@ RUN pacman -Syyu --noconfirm && \
3235
pacman -U --noconfirm ./headers.tar.xz && \
3336
rm -v ./headers.tar.xz && \
3437
ln -s /usr/lib/systemd/systemd /sbin/init && \
35-
yes | pacman -Scc || exit 0
38+
pacman -Scc --noconfirm || exit 0

images/aarch64/fedora/6.2/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ARG HVERSION=6.2.6-300
55
ARG ARCHITECTURE=aarch64
66
ARG URL='https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/38/Everything/aarch64/os/Packages'
77

8+
# Use bash for all RUN steps with some safety options enabled.
9+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
10+
811
RUN dnf groupinstall -y 'Development Tools' && \
912
dnf install -y \
1013
clang \

images/aarch64/oraclelinux/4.14/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM oraclelinux:7
33
ARG VERSION=4.14.35-2047.527.2
44
ARG URL='https://yum.oracle.com/repo/OracleLinux/OL7/latest/aarch64'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
COPY /dev.repo /etc/yum.repos.d/
710

811
RUN yum groupinstall -y 'Development Tools' && \

images/aarch64/oraclelinux/5.15/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ARG VERSION=5.15.0-8.91.4.1
44
ARG URL='https://yum.oracle.com/repo/OracleLinux/OL9/baseos/latest/aarch64'
55
ARG ARCHITECTURE='aarch64'
66

7+
# Use bash for all RUN steps with some safety options enabled.
8+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
9+
710
RUN yum install -y \
811
binutils-devel \
912
clang \

images/aarch64/ubuntu/6.5/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM ubuntu:22.04
33
ARG VERSION=6.5.0-1024-aws
44
ARG URL='https://ports.ubuntu.com/ubuntu-ports/pool/main/l/linux-aws-6.5/'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
WORKDIR /home/ubuntu
710

811
RUN apt-get update && apt-get install -y \

images/builder/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM centos:7
33
# TARGETARCH is automatically set by BuildKit (arm64 or amd64)
44
ARG TARGETARCH
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
COPY /dhclient.service /usr/lib/systemd/system/
710

811
# Fix broken mirrors - centos:7 eol

images/modernprobe-builder/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM fedora:latest
22

3+
# Use bash for all RUN steps with some safety options enabled.
4+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
5+
36
COPY /dhclient.service /usr/lib/systemd/system/
47

58
RUN dnf install -y \

images/x86_64/amazonlinux2/4.19/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ FROM amazonlinux:2
33
ARG VERSION=4.19.84-33.70
44
ARG URL='http://amazonlinux.us-east-1.amazonaws.com/2/extras/kernel-ng/latest/x86_64'
55

6+
# Use bash for all RUN steps with some safety options enabled.
7+
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
8+
69
RUN yum install -y \
710
binutils-devel \
811
clang \

0 commit comments

Comments
 (0)