Skip to content

Commit d6b03c9

Browse files
author
Phileas Lebada
committed
Use Dockernative shell-argument options
1 parent 7632c85 commit d6b03c9

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

Dockerfile-alpine.template

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM alpine:%%PLACEHOLDER%%
22

3+
SHELL ["/usr/bin/env", "sh", "-eux", "-c"]
4+
35
RUN apk add --no-cache \
46
gmp-dev
57

@@ -20,9 +22,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%%
2022
# some of ruby's build scripts are written in ruby
2123
# we purge system ruby later to make sure our final image uses what we just built
2224
# readline-dev vs libedit-dev: https://bugs.ruby-lang.org/issues/11869 and https://github.com/docker-library/ruby/issues/75
23-
RUN set -eux; \
24-
\
25-
apk add --no-cache --virtual .ruby-builddeps \
25+
RUN apk add --no-cache --virtual .ruby-builddeps \
2626
autoconf \
2727
bison \
2828
bzip2 \
@@ -111,7 +111,8 @@ RUN set -eux; \
111111
rm -r /usr/src/ruby; \
112112
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
113113
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
114-
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
114+
gem update --system "$RUBYGEMS_VERSION"; \
115+
rm -fr /root/.gem/; \
115116
# verify we have no "ruby" packages installed
116117
! apk --no-network list --installed \
117118
| grep -v '^[.]ruby-rundeps' \
@@ -129,6 +130,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
129130
BUNDLE_APP_CONFIG="$GEM_HOME"
130131
ENV PATH $GEM_HOME/bin:$PATH
131132
# adjust permissions of a few directories for running "gem install" as an arbitrary user
132-
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
133+
RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME"
133134

134135
CMD [ "irb" ]

Dockerfile-debian.template

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
FROM buildpack-deps:%%PLACEHOLDER%%
22

3+
SHELL ["/bin/bash", "-eux", "-c"]
4+
35
# skip installing gem documentation
4-
RUN set -eux; \
5-
mkdir -p /usr/local/etc; \
6+
RUN mkdir -p /usr/local/etc; \
67
{ \
78
echo 'install: --no-document'; \
89
echo 'update: --no-document'; \
@@ -16,9 +17,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%%
1617

1718
# some of ruby's build scripts are written in ruby
1819
# we purge system ruby later to make sure our final image uses what we just built
19-
RUN set -eux; \
20-
\
21-
savedAptMark="$(apt-mark showmanual)"; \
20+
RUN savedAptMark="$(apt-mark showmanual)"; \
2221
apt-get update; \
2322
apt-get install -y --no-install-recommends \
2423
bison \
@@ -73,7 +72,8 @@ RUN set -eux; \
7372
rm -r /usr/src/ruby; \
7473
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
7574
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
76-
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
75+
gem update --system "$RUBYGEMS_VERSION"; \
76+
rm -fr /root/.gem/; \
7777
# verify we have no "ruby" packages installed
7878
! dpkg -l | grep -i ruby; \
7979
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
@@ -88,6 +88,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
8888
BUNDLE_APP_CONFIG="$GEM_HOME"
8989
ENV PATH $GEM_HOME/bin:$PATH
9090
# adjust permissions of a few directories for running "gem install" as an arbitrary user
91-
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
91+
RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME"
9292

9393
CMD [ "irb" ]

Dockerfile-slim.template

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM debian:%%PLACEHOLDER%%
22

3-
RUN set -eux; \
4-
apt-get update; \
3+
SHELL ["/bin/bash", "-eux", "-c"]
4+
5+
RUN apt-get update; \
56
apt-get install -y --no-install-recommends \
67
bzip2 \
78
ca-certificates \
@@ -15,8 +16,7 @@ RUN set -eux; \
1516
rm -rf /var/lib/apt/lists/*
1617

1718
# skip installing gem documentation
18-
RUN set -eux; \
19-
mkdir -p /usr/local/etc; \
19+
RUN mkdir -p /usr/local/etc; \
2020
{ \
2121
echo 'install: --no-document'; \
2222
echo 'update: --no-document'; \
@@ -30,9 +30,7 @@ ENV RUBYGEMS_VERSION %%RUBYGEMS%%
3030

3131
# some of ruby's build scripts are written in ruby
3232
# we purge system ruby later to make sure our final image uses what we just built
33-
RUN set -eux; \
34-
\
35-
savedAptMark="$(apt-mark showmanual)"; \
33+
RUN savedAptMark="$(apt-mark showmanual)"; \
3634
apt-get update; \
3735
apt-get install -y --no-install-recommends \
3836
autoconf \
@@ -99,7 +97,8 @@ RUN set -eux; \
9997
rm -r /usr/src/ruby; \
10098
# make sure bundled "rubygems" is older than RUBYGEMS_VERSION (https://github.com/docker-library/ruby/issues/246)
10199
ruby -e 'exit(Gem::Version.create(ENV["RUBYGEMS_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
102-
gem update --system "$RUBYGEMS_VERSION" && rm -r /root/.gem/; \
100+
gem update --system "$RUBYGEMS_VERSION"; \
101+
rm -r /root/.gem/; \
103102
# verify we have no "ruby" packages installed
104103
! dpkg -l | grep -i ruby; \
105104
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]; \
@@ -114,6 +113,6 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
114113
BUNDLE_APP_CONFIG="$GEM_HOME"
115114
ENV PATH $GEM_HOME/bin:$PATH
116115
# adjust permissions of a few directories for running "gem install" as an arbitrary user
117-
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
116+
RUN mkdir -p "$GEM_HOME"; chmod 777 "$GEM_HOME"
118117

119118
CMD [ "irb" ]

0 commit comments

Comments
 (0)