From 73e7b3b086dadba60fb61041d066cdc26149d1fa Mon Sep 17 00:00:00 2001 From: Enrique Garcia Cota Date: Thu, 27 Jun 2024 17:14:19 +0200 Subject: [PATCH] fix(ci): copy alpine inside alpine/Dockerfile --- alpine/Dockerfile | 55 ++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/alpine/Dockerfile b/alpine/Dockerfile index 2ab1c674..6b635fd7 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -1,56 +1,43 @@ FROM alpine:3.18 -LABEL maintainer="Kong " - -ARG ASSET=ce -ENV ASSET $ASSET - -ARG EE_PORTS - -# hadolint ignore=DL3010 -COPY kong.tar.gz /tmp/kong.tar.gz - ARG KONG_VERSION=2.8.5 ENV KONG_VERSION $KONG_VERSION ARG KONG_AMD64_SHA="22a5cd7c981ec15b34db105aabac7815bd589380a8d27d0c9e138657a9da6332" -# hadolint ignore=DL3018 -RUN set -eux; \ - arch="$(apk --print-arch)"; \ +ARG KONG_PREFIX=/usr/local/kong +ENV KONG_PREFIX $KONG_PREFIX + +ARG ASSET=remote +ARG EE_PORTS + +COPY kong.apk.tar.gz /tmp/kong.apk.tar.gz + +RUN set -ex; \ major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \ KONG_SHA256=$KONG_AMD64_SHA ; \ - if [ "$ASSET" = "ce" ] ; then \ - apk add --no-cache --virtual .build-deps curl wget tar ca-certificates \ - && curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/alpine/any-version/main/x86_64/kong-${KONG_VERSION}.apk" -o /tmp/kong.tar.gz \ - && echo "$KONG_SHA256 /tmp/kong.tar.gz" | sha256sum -c - \ - && apk del .build-deps; \ - else \ - # this needs to stay inside this "else" block so that it does not become part of the "official images" builds (https://github.com/docker-library/official-images/pull/11532#issuecomment-996219700) - apk upgrade; \ + apk add bash curl ca-certificates; \ + if [ "$ASSET" = "remote" ] ; then \ + curl -fL "https://packages.konghq.com/public/gateway-${major_minor}/alpine/any-version/main/x86_64/kong-${KONG_VERSION}.apk" -o /tmp/kong.apk.tar.gz \ + && echo "$KONG_SHA256 /tmp/kong.apk.tar.gz" | sha256sum -c -; \ fi \ - && mkdir /kong \ - && tar -C /kong -xzf /tmp/kong.tar.gz \ - && mv /kong/usr/local/* /usr/local \ - && mv /kong/etc/* /etc \ - && rm -rf /kong \ - && apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zip bash zlib zlib-dev git ca-certificates \ - && apk add --no-cache luarocks \ + && apk add --no-cache --virtual .build-deps tar gzip \ + && tar -C / -xzf /tmp/kong.apk.tar.gz \ + && apk add --no-cache libstdc++ libgcc openssl pcre perl tzdata libcap zlib zlib-dev bash luarocks yaml \ && adduser -S kong \ && addgroup -S kong \ - && mkdir -p "/usr/local/kong" \ - && chown -R kong:0 /usr/local/kong \ + && mkdir -p "${KONG_PREFIX}" \ + && chown -R kong:0 ${KONG_PREFIX} \ && chown kong:0 /usr/local/bin/kong \ - && chmod -R g=u /usr/local/kong \ + && chmod -R g=u ${KONG_PREFIX} \ && rm -rf /tmp/kong.tar.gz \ && ln -sf /usr/local/openresty/bin/resty /usr/local/bin/resty \ && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \ && ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \ && ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \ && ln -sf /usr/local/lib/luarocks/*/luarocks/*/bin/luarocks-admin /usr/local/bin/luarocks-admin \ - && if [ "$ASSET" = "ce" ] ; then \ - kong version; \ - fi + && apk del .build-deps \ + && kong version COPY docker-entrypoint.sh /docker-entrypoint.sh