Skip to content

Commit d58b81a

Browse files
committed
modernize RUN commands in Containerfiles
As RUN commands on multiline is like a shell script, enable the bash strict mode. So we can remove all the `&&` at the begin of lines. When buildah (podman builder) recent release will be published in common distributions (at least Debian stable), we will be able to use the "heredoc" syntax to avoid all the `; \` at end of lines.
1 parent be32138 commit d58b81a

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

Container.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ If you use Podman, you can either use the same Docker compose plugin or the
1616
[podman-compose](https://github.com/containers/podman-compose/)
1717
utility. The podman cli itself provide a wrapper of one of these two tools through the
1818
[`podman compose` command](https://docs.podman.io/en/latest/markdown/podman-compose.1.html).
19+
Thus you need to use the `podman compose up` command to start the system.
1920

2021
At this point, the documentation will give you `docker compose` commands, but you should be able
2122
to use `podman compose` without any issue.

deployment/database/docker-entrypoint-initdb.d/001-create-database-test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#/usr/bin/env sh
22

33
set -euo pipefail
4+
IFS=$'\n\t'
45

56
mysql -uroot -hlocalhost -p"${MYSQL_ROOT_PASSWORD}" <<EOSQL
67
CREATE USER IF NOT EXISTS '${MYSQL_TEST_USER}'@'%' IDENTIFIED BY '${MYSQL_TEST_PASSWORD}';

deployment/linuxfr-img/Containerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>"
1010

1111
ARG UID=1200
1212

13-
RUN apt-get update \
14-
&& apt-get install -y --no-install-recommends \
15-
golang git ca-certificates \
16-
&& apt-get clean
13+
RUN \
14+
set -eux; \
15+
IFS=$'\n\t'; \
16+
apt-get update; \
17+
apt-get install -y --no-install-recommends \
18+
golang git ca-certificates; \
19+
apt-get clean;
1720

1821
USER ${UID}
1922
ENV GOPATH=/linuxfr-img

deployment/linuxfr.org/Containerfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ LABEL org.opencontainers.image.authors="Adrien Dorsaz <[email protected]>"
1111
ARG UID=1200
1212

1313
# Install system dependencies
14-
RUN apt-get update \
15-
&& apt-get install -y --no-install-recommends --allow-downgrades \
14+
RUN \
15+
set -eux; \
16+
IFS=$'\n\t'; \
17+
apt-get update; \
18+
apt-get install -y --no-install-recommends --allow-downgrades \
1619
mariadb-client libmariadb++-dev git \
1720
build-essential openssl libreadline-dev curl libcurl4-openssl-dev zlib1g \
1821
zlib1g-dev libssl-dev libxml2-dev libxslt-dev autoconf libgmp-dev libyaml-dev \
1922
ncurses-dev bison automake libtool imagemagick libc6-dev hunspell \
2023
hunspell-fr-comprehensive ruby ruby-dev ruby-rack \
21-
nodejs npm \
22-
&& gem install bundler -v 2.4.20 \
23-
&& apt-get clean
24+
nodejs npm; \
25+
gem install bundler -v 2.4.20; \
26+
apt-get clean;
2427

2528
USER ${UID}
2629
ENV HOME=/linuxfr.org
@@ -29,9 +32,12 @@ WORKDIR /linuxfr.org
2932
# Install external dependencies
3033
COPY --chown=${UID}:0 --chmod=770 Gemfile* ./
3134

32-
RUN bundle config set path 'vendor/bundle' \
33-
&& bundle config set deployment 'true' \
34-
&& bundle install
35+
RUN \
36+
set -eux; \
37+
IFS=$'\n\t'; \
38+
bundle config set path 'vendor/bundle'; \
39+
bundle config set deployment 'true'; \
40+
bundle install;
3541

3642
# Configure the application
3743
COPY --chown=${UID}:0 --chmod=770 deployment/linuxfr.org/database.yml config/database.yml

0 commit comments

Comments
 (0)