-
Notifications
You must be signed in to change notification settings - Fork 838
/
Copy pathDockerfile
68 lines (54 loc) · 2.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM alpine:3.16
LABEL maintainer="Kong <support@konghq.com>"
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.3
ENV KONG_VERSION $KONG_VERSION
ARG KONG_AMD64_SHA="962ac92c9834cb59f1d6563412714f3d6eecfe6c6849a84cfcbe7a4b3facbf46"
ARG KONG_ARM64_SHA="7076e6ee6a03df86795a1a08cf86e0349a150095e61be266db462cb7de9fd745"
# hadolint ignore=DL3018
RUN set -eux; \
arch="$(apk --print-arch)"; \
case "${arch}" in \
x86_64) arch='amd64'; KONG_SHA256=$KONG_AMD64_SHA ;; \
aarch64) arch='arm64'; KONG_SHA256=$KONG_ARM64_SHA ;; \
esac; \
if [ "$ASSET" = "ce" ] ; then \
apk add --no-cache --virtual .build-deps curl wget tar ca-certificates \
&& curl -fL "https://download.konghq.com/gateway-${KONG_VERSION%%.*}.x-alpine/kong-$KONG_VERSION.$arch.apk.tar.gz" -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; \
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 \
&& adduser -S kong \
&& addgroup -S kong \
&& mkdir -p "/usr/local/kong" \
&& chown -R kong:0 /usr/local/kong \
&& chown kong:0 /usr/local/bin/kong \
&& chmod -R g=u /usr/local/kong \
&& rm -rf /tmp/kong.tar.gz \
&& ln -s /usr/local/openresty/bin/resty /usr/local/bin/resty \
&& ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit \
&& ln -s /usr/local/openresty/luajit/bin/luajit /usr/local/bin/lua \
&& ln -s /usr/local/openresty/nginx/sbin/nginx /usr/local/bin/nginx \
&& if [ "$ASSET" = "ce" ] ; then \
kong version; \
fi
COPY docker-entrypoint.sh /docker-entrypoint.sh
USER kong
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 8000 8443 8001 8444 $EE_PORTS
STOPSIGNAL SIGQUIT
HEALTHCHECK --interval=10s --timeout=10s --retries=10 CMD kong health
CMD ["kong", "docker-start"]