From 1edb42a73dd42241998339251b00777828305f4e Mon Sep 17 00:00:00 2001 From: Tobias Hargesheimer Date: Sat, 2 Nov 2024 20:10:07 +0100 Subject: [PATCH] scratch update scratch update with static-curl --- docker-compose.yml | 4 ++-- scratch.multiarch.release.Dockerfile | 35 +++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9e1f56a..2a46b9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: # context: ./ # dockerfile: alpine.multiarch.git_master.Dockerfile #image: tobi312/minio:development - image: tobi312/minio:latest + image: tobi312/minio:latest # or: tobi312/minio:scratch container_name: minio #restart: unless-stopped ports: @@ -39,7 +39,7 @@ services: #test: ["CMD", "curl", "--fail", "--insecure", "https://localhost:9000/minio/health/live"] # when use minio ssl #start_period: 30s interval: 60s - timeout: 10s + timeout: 5s retries: 3 networks: storage: diff --git a/scratch.multiarch.release.Dockerfile b/scratch.multiarch.release.Dockerfile index 6e65a74..c0f16a0 100644 --- a/scratch.multiarch.release.Dockerfile +++ b/scratch.multiarch.release.Dockerfile @@ -66,6 +66,39 @@ RUN \ curl -s -q https://raw.githubusercontent.com/minio/minio/${MINIO_RELEASE_VERSION}/dockerscripts/docker-entrypoint.sh -o /usr/bin/docker-entrypoint.sh && \ chmod +x /usr/bin/docker-entrypoint.sh +FROM alpine:latest as static-curl + +# curl: https://github.com/stunnel/static-curl +# (Alternatives: https://github.com/moparisthebest/static-curl/releases or https://github.com/perryflynn/static-binaries) + +ARG CURL_VERSION + +RUN \ + set -ex ; \ + #apk add --no-cache curl ca-certificates ; \ + ARCH=`uname -m` ; \ + echo "ARCH=$ARCH" ; \ + if [ "$ARCH" == "x86_64" ]; then \ + echo "x86_64 (amd64)" ; \ + TARGETARCH="$ARCH"; \ + elif [ "$ARCH" == "aarch64" ]; then \ + echo "aarch64 (arm64)" ; \ + TARGETARCH="$ARCH"; \ + elif [ "$ARCH" == "armv7l" ]; then \ + echo "armv7l (arm)" ; \ + TARGETARCH="armv7"; \ + else \ + echo "unknown arch" ; \ + exit 1; \ + fi ; \ + export TARGETARCH=${TARGETARCH} ; \ + #CURL_VERSION=${CURL_VERSION:-$(curl -s https://api.github.com/repos/stunnel/static-curl/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \ + CURL_VERSION=${CURL_VERSION:-$(wget -qO- https://api.github.com/repos/stunnel/static-curl/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \ + echo "CURL_VERSION=${CURL_VERSION}" ; \ + #curl -sqL https://github.com/stunnel/static-curl/releases/download/${CURL_VERSION}/curl-linux-${TARGETARCH}-musl-${CURL_VERSION}.tar.xz | tar -xJ -C /usr/local/bin/ curl ; \ + wget -qO- https://github.com/stunnel/static-curl/releases/download/${CURL_VERSION}/curl-linux-${TARGETARCH}-musl-${CURL_VERSION}.tar.xz | tar -xJ -C /usr/local/bin/ curl ; \ + /usr/local/bin/curl --version + FROM scratch ARG MINIO_RELEASE_VERSION @@ -98,7 +131,7 @@ ENV MINIO_ACCESS_KEY_FILE=access_key \ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=build /usr/bin/minio /usr/bin/minio COPY --from=build /usr/bin/mc /usr/bin/mc -#COPY --from=build /usr/bin/curl /usr/bin/curl # https://github.com/moparisthebest/static-curl/releases or https://github.com/stunnel/static-curl or https://github.com/perryflynn/static-binaries ? +COPY --from=static-curl /usr/local/bin/curl /usr/bin/curl COPY --from=build /licenses/CREDITS /licenses/CREDITS COPY --from=build /licenses/LICENSE /licenses/LICENSE