From b7e1e4fd9eb555517428c112dbcd6e0a73d27ba9 Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Fri, 21 Feb 2020 10:52:43 +1000 Subject: [PATCH] Use the corresponding s6 binary for the built arch - fixes #298 --- docker/Dockerfile | 8 +++++--- scripts/install-s6 | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100755 scripts/install-s6 diff --git a/docker/Dockerfile b/docker/Dockerfile index d3cb40d..f07b5f0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,6 +5,8 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} jc21/alpine-nginx-full:node +ARG TARGETPLATFORM +ARG BUILDPLATFORM ARG BUILD_VERSION ARG BUILD_COMMIT ARG BUILD_DATE @@ -22,8 +24,8 @@ RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \ ENV NPM_BUILD_VERSION="${BUILD_VERSION}" NPM_BUILD_COMMIT="${BUILD_COMMIT}" NPM_BUILD_DATE="${BUILD_DATE}" # s6 overlay -RUN curl -L -o /tmp/s6-overlay-amd64.tar.gz "https://github.com/just-containers/s6-overlay/releases/download/v1.22.1.0/s6-overlay-amd64.tar.gz" \ - && tar -xzf /tmp/s6-overlay-amd64.tar.gz -C / +COPY scripts/install-s6 /tmp/install-s6 +RUN /tmp/install-s6 "${TARGETPLATFORM}" && rm -f /tmp/install-s6 EXPOSE 80 EXPOSE 81 @@ -43,4 +45,4 @@ RUN rm -rf /etc/services.d/frontend RUN rm -f /etc/nginx/conf.d/dev.conf VOLUME [ "/data", "/etc/letsencrypt" ] CMD [ "/init" ] -HEALTHCHECK --interval=5s --timeout=3s CMD /bin/check-health \ No newline at end of file +HEALTHCHECK --interval=5s --timeout=3s CMD /bin/check-health diff --git a/scripts/install-s6 b/scripts/install-s6 new file mode 100755 index 0000000..8bb85e4 --- /dev/null +++ b/scripts/install-s6 @@ -0,0 +1,34 @@ +#!/bin/bash -e + +# Note: This script is designed to be run inside a Docker Build for a container + +CYAN='\E[1;36m' +YELLOW='\E[1;33m' +BLUE='\E[1;34m' +GREEN='\E[1;32m' +RESET='\E[0m' + +S6_OVERLAY_VERSION=1.22.1.0 +TARGETPLATFORM=$1 + +# Determine the correct binary file for the architecture given +case $TARGETPLATFORM in + linux/arm64) + S6_ARCH=aarch64 + ;; + + linux/arm/v7) + S6_ARCH=armhf + ;; + + *) + S6_ARCH=amd64 + ;; +esac + +echo -e "${BLUE}❯ ${CYAN}Installing S6-overlay v${S6_OVERLAY_VERSION} for ${YELLOW}${TARGETPLATFORM} (${S6_ARCH})${RESET}" + +curl -L -o "/tmp/s6-overlay-${S6_ARCH}.tar.gz" "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz" \ + && tar -xzf "/tmp/s6-overlay-${S6_ARCH}.tar.gz" -C / + +echo -e "${BLUE}❯ ${GREEN}S6-overlay install Complete${RESET}"