Home > OS >  Why building this image on CircleCI fails where as it works perfectly anywhere else?
Why building this image on CircleCI fails where as it works perfectly anywhere else?

Time:12-15

As it can be seen in the logs that curl has been installed correctly, why does it not find it wheen curl is being used?

Build log:

Step 15/28 : RUN apk add --no-cache ca-certificates gcc linux-headers musl-dev     libffi-dev jpeg-dev zlib-dev git openssl openssl-dev postgresql-dev build-base     libressl-dev binutils proj-dev curl libcurl curl-dev bash make     && curl -sL https://sentry.io/get-cli/ | bash     && pip install --no-cache-dir --upgrade pip     && pip install --no-cache-dir -r /tmp/common.txt     && pip install --no-cache-dir -r /tmp/prod.txt     && find /usr/local         \( -type d -a -name test -o -name tests \)         -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \)         -exec rm -rf '{}'       && runDeps="$(         scanelf --needed --nobanner --recursive /usr/local                 | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }'                 | sort -u                 | xargs -r apk info --installed                 | sort -u     ) gdal"     && apk add --no-cache $runDeps     && rm -rf /var/cache/apk/* RUN addgroup -S appgroup && adduser -S appuser -G appgroup
 ---> Running in 37d6ce0bf4dc
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/61) Installing bash (5.1.4-r0)
Executing bash-5.1.4-r0.post-install
(2/61) Installing libgcc (10.3.1_git20210424-r2)
(3/61) Installing libstdc   (10.3.1_git20210424-r2)
(4/61) Installing binutils (2.35.2-r2)
(5/61) Installing libmagic (5.40-r1)
(6/61) Installing file (5.40-r1)
(7/61) Installing libgomp (10.3.1_git20210424-r2)
(8/61) Installing libatomic (10.3.1_git20210424-r2)
(9/61) Installing libgphobos (10.3.1_git20210424-r2)
(10/61) Installing gmp (6.2.1-r0)
(11/61) Installing isl22 (0.22-r0)
(12/61) Installing mpfr4 (4.1.0-r0)
(13/61) Installing mpc1 (1.2.1-r0)
(14/61) Installing gcc (10.3.1_git20210424-r2)
(15/61) Installing musl-dev (1.2.2-r3)
(16/61) Installing libc-dev (0.7.2-r3)
(17/61) Installing g   (10.3.1_git20210424-r2)
(18/61) Installing make (4.3-r0)
(19/61) Installing fortify-headers (1.1-r1)
(20/61) Installing patch (2.7.6-r7)
(21/61) Installing build-base (0.5-r2)
(22/61) Installing brotli-libs (1.0.9-r5)
(23/61) Installing nghttp2-libs (1.43.0-r0)
(24/61) Installing libcurl (7.79.1-r0)
(25/61) Installing curl (7.79.1-r0)
(26/61) Installing pkgconf (1.7.4-r0)
(27/61) Installing openssl-dev (1.1.1l-r0)
(28/61) Installing nghttp2-dev (1.43.0-r0)
(29/61) Installing zlib-dev (1.2.11-r3)
(30/61) Installing brotli-dev (1.0.9-r5)
(31/61) Installing curl-dev (7.79.1-r0)
(32/61) Installing pcre2 (10.36-r0)
(33/61) Installing git (2.32.0-r0)
(34/61) Installing libjpeg-turbo (2.1.0-r0)
(35/61) Installing libjpeg-turbo-dev (2.1.0-r0)
(36/61) Installing jpeg-dev (9d-r1)
(37/61) Installing linux-headers (5.10.41-r0)
(38/61) Installing libffi-dev (3.3-r2)
(39/61) Installing libressl3.3-libcrypto (3.3.3-r0)
(40/61) Installing libressl3.3-libssl (3.3.3-r0)
(41/61) Installing libressl3.3-libtls (3.3.3-r0)
(42/61) Installing libressl-dev (3.3.3-r0)
(43/61) Installing openssl (1.1.1l-r0)
(44/61) Installing libxml2 (2.9.12-r1)
(45/61) Installing llvm11-libs (11.1.0-r2)
(46/61) Installing clang-libs (11.1.0-r1)
(47/61) Installing clang (11.1.0-r1)
(48/61) Installing icu-libs (67.1-r2)
(49/61) Installing icu (67.1-r2)
(50/61) Installing icu-dev (67.1-r2)
(51/61) Installing llvm11 (11.1.0-r2)
(52/61) Installing libsasl (2.1.27-r12)
(53/61) Installing libldap (2.4.58-r0)
(54/61) Installing libpq (13.5-r0)
(55/61) Installing postgresql-libs (13.5-r0)
(56/61) Installing postgresql-dev (13.5-r0)
(57/61) Installing libwebp (1.2.0-r2)
(58/61) Installing zstd-libs (1.4.9-r1)
(59/61) Installing tiff (4.2.0-r1)
(60/61) Installing proj (7.2.1-r0)
(61/61) Installing proj-dev (7.2.1-r0)
Executing busybox-1.33.1-r6.trigger
OK: 581 MiB in 97 packages
This script will automatically install sentry-cli 1.71.0 for you.
Installation path: /usr/local/bin/sentry-cli
Warning: this script is currently running as root. This is dangerous. 
         Instead run it as normal user. We will sudo as needed.
error: you do not have 'curl' installed which is required for this script.
The command '/bin/sh -c apk add --no-cache ca-certificates gcc linux-headers musl-dev     libffi-dev jpeg-dev zlib-dev git openssl openssl-dev postgresql-dev build-base     libressl-dev binutils proj-dev curl libcurl curl-dev bash make     && curl -sL https://sentry.io/get-cli/ | bash     && pip install --no-cache-dir --upgrade pip     && pip install --no-cache-dir -r /tmp/common.txt     && pip install --no-cache-dir -r /tmp/prod.txt     && find /usr/local         \( -type d -a -name test -o -name tests \)         -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \)         -exec rm -rf '{}'       && runDeps="$(         scanelf --needed --nobanner --recursive /usr/local                 | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }'                 | sort -u                 | xargs -r apk info --installed                 | sort -u     ) gdal"     && apk add --no-cache $runDeps     && rm -rf /var/cache/apk/* RUN addgroup -S appgroup && adduser -S appuser -G appgroup' returned a non-zero code: 1

Exited with code exit status 1
CircleCI received exit code 1

Dockerfile

FROM python:3.9.9-alpine3.14 as base-image

ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG AWS_REGION=ap-south-1
ARG ENV=staging

ENV PYTHONUNBUFFERED 1
ENV AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
ENV AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
ENV AWS_REGION=$AWS_REGION
ENV ENV=$ENV
ENV PYCURL_SSL_LIBRARY=openssl

# Avoid stuck build due to user prompt
ARG DEBIAN_FRONTEND=noninteractive

# Copy Django app dependencies
COPY requirements/common.txt /tmp/common.txt
COPY requirements/prod.txt /tmp/prod.txt

# Install dependencies
RUN apk add --no-cache ca-certificates gcc linux-headers musl-dev \
    libffi-dev jpeg-dev zlib-dev git openssl openssl-dev postgresql-dev build-base \
    libressl-dev binutils proj-dev curl libcurl curl-dev bash make \
    && curl -sL https://sentry.io/get-cli/ | bash \
    && pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir -r /tmp/common.txt \
    && pip install --no-cache-dir -r /tmp/prod.txt \
    && find /usr/local \
        \( -type d -a -name test -o -name tests \) \
        -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
        -exec rm -rf '{}'   \
    && runDeps="$( \
        scanelf --needed --nobanner --recursive /usr/local \
                | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
                | sort -u \
                | xargs -r apk info --installed \
                | sort -u \
    ) gdal" \
    && apk add --no-cache $runDeps \
    && rm -rf /var/cache/apk/* \

CodePudding user response:

That error is from the Sentry script itself. You do have curl installed otherwise that script wouldn't have been downloaded and run in the first place.

The Sentry script is itself doing a check for curl and saying that it can't find it. Likely because it's doing the check with hash which is a Bash built-in command. You are running Alpine. Issues like this tend to crop up on Alpine and you really need to know what you're doing to get things to work.

I suggest run a custom version of the Sentry script yourself that's Alpine friendly or, my preferred option, base your image off of Ubuntu or Debian and not Alpine.

  • Related