Skip to content

Commit

Permalink
fix(ci): copy alpine inside alpine/Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kikito committed Jun 27, 2024
1 parent 7ba315d commit 73e7b3b
Showing 1 changed file with 21 additions and 34 deletions.
55 changes: 21 additions & 34 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
FROM alpine:3.18

LABEL maintainer="Kong <[email protected]>"

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

Expand Down

0 comments on commit 73e7b3b

Please sign in to comment.