Skip to content

Commit

Permalink
multi arch S6 with fixed S6 version
Browse files Browse the repository at this point in the history
  • Loading branch information
manuc66 committed Jul 23, 2022
1 parent aa47f9a commit 13c0fcf
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,34 @@ FROM node:alpine as app
ENV NODE_ENV production
ADD root/ /

# add S6 Overlay
ADD https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz \
&& apk add --no-cache shadow tzdata # install shadow (for groupmod and usermod) and tzdata (for TZ env variable)
# sets version for s6 overlay
ARG S6_SRC_DEP="ca-certificates xz-utils wget"
ARG S6_SRC_URL="https://github.com/just-containers/s6-overlay/releases/download"
ARG S6_VERSION=v3.1.1.2

# detect system arch then select the right version of s6
RUN export SYS_ARCH=$(uname -m); \
case "$SYS_ARCH" in \
aarch64 ) export S6_ARCH='aarch64' ;; \
arm64 ) export S6_ARCH='aarch64' ;; \
armhf ) export S6_ARCH='armhf' ;; \
arm* ) export S6_ARCH='arm' ;; \
i4* ) export S6_ARCH='i486' ;; \
i6* ) export S6_ARCH='i686' ;; \
riscv64 ) export S6_ARCH='riscv64' ;; \
s390* ) export S6_ARCH='s390x' ;; \
* ) export S6_ARCH='x86_64' ;; \
esac; \
untar (){ \
echo "⏬ Downloading $1"; \
wget -O- $1 | tar Jxp -C /; \
}; \
\
echo "⬇️ Downloading s6 overlay:${S6_ARCH}-${S6_VERSION} for ${SYS_ARCH}" \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-noarch.tar.xz \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.xz \
echo "⬇️ Install shadow (for groupmod and usermod) and tzdata (for TZ env variable)" \
&& apk add --no-cache shadow tzdata

# add builded app
WORKDIR /app
Expand Down

0 comments on commit 13c0fcf

Please sign in to comment.