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 982a6da commit 246616e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 37 deletions.
8 changes: 4 additions & 4 deletions Dockerfile.apk
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ ENV KONG_PREFIX $KONG_PREFIX
ARG ASSET=remote
ARG EE_PORTS

COPY kong.apk.tar.gz /tmp/kong.apk.tar.gz
COPY kong.tar.gz /tmp/kong.tar.gz

RUN set -ex; \
major_minor="$(echo "${KONG_VERSION%.*}" | tr -d '.')"; \
KONG_SHA256=$KONG_AMD64_SHA ; \
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 -; \
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 -; \
fi \
&& apk add --no-cache --virtual .build-deps tar gzip \
&& tar -C / -xzf /tmp/kong.apk.tar.gz \
&& tar -C / -xzf /tmp/kong.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 \
Expand Down
53 changes: 20 additions & 33 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,43 @@
FROM alpine:3.18

LABEL maintainer="Kong <support@konghq.com>"
ARG KONG_VERSION=2.8.5
ENV KONG_VERSION $KONG_VERSION

ARG ASSET=ce
ENV ASSET $ASSET
ARG KONG_AMD64_SHA="22a5cd7c981ec15b34db105aabac7815bd589380a8d27d0c9e138657a9da6332"

ARG KONG_PREFIX=/usr/local/kong
ENV KONG_PREFIX $KONG_PREFIX

ARG ASSET=remote
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)"; \
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.tar.gz \
&& echo "$KONG_SHA256 /tmp/kong.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.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 246616e

Please sign in to comment.