22FROM ubuntu:jammy as graylog-downloader
33
44ARG VCS_REF
5+ ARG BUILD_DATE
56ARG GRAYLOG_VERSION
7+ ARG GRAYLOG_PRODUCT=graylog
68ARG GRAYLOG_HOME=/usr/share/graylog
79ARG GRAYLOG_UID=1100
810ARG GRAYLOG_GID=1100
11+ ARG TARGETPLATFORM
12+
13+ # We default to an empty file instead of leaving LOCAL_BUILD_TGZ blank
14+ # because Docker would execute the following COPY command with a blank
15+ # value:
16+ # COPY "" "/tmp/graylog.tgz"
17+ # That creates a /tmp/graylog.tgz *directory* in the container with
18+ # all files from the build context.
19+ ARG LOCAL_BUILD_TGZ=.empty
20+
21+ # Allows building a custom artifact. (e.g., snapshot builds)
22+ ARG DOWNLOAD_URL=none
923
1024WORKDIR /tmp
1125
12- # hadolint ignore=DL3008,DL3015,DL3059
26+ # hadolint ignore=DL3008,DL3015
1327RUN \
1428 apt-get update > /dev/null && \
1529 apt-get upgrade -y > /dev/null && \
@@ -18,10 +32,27 @@ RUN \
1832 curl > /dev/null
1933
2034COPY build/fetch-and-extract.sh /bin/fetch-and-extract
21- RUN chmod +x /bin/fetch-and-extract && fetch-and-extract \
22- "https://packages.graylog2.org/releases/graylog/graylog-${GRAYLOG_VERSION}.tgz" \
23- "https://packages.graylog2.org/releases/graylog/graylog-${GRAYLOG_VERSION}.tgz.sha256.txt"
2435
36+ RUN if [ "${LOCAL_BUILD_TGZ}" = ".empty" ] && [ "${DOWNLOAD_URL}" = "none" ]; then \
37+ chmod +x /bin/fetch-and-extract \
38+ && fetch-and-extract \
39+ "https://downloads.graylog.org/releases/${GRAYLOG_PRODUCT}/${GRAYLOG_PRODUCT}-${GRAYLOG_VERSION}.tgz" \
40+ "https://downloads.graylog.org/releases/${GRAYLOG_PRODUCT}/${GRAYLOG_PRODUCT}-${GRAYLOG_VERSION}.tgz.sha256.txt" ; \
41+ fi
42+
43+ RUN if [ "${DOWNLOAD_URL}" != "none" ]; then \
44+ chmod +x /bin/fetch-and-extract && fetch-and-extract "${DOWNLOAD_URL}" ; \
45+ fi
46+
47+ COPY "${LOCAL_BUILD_TGZ}" "/tmp/graylog.tgz"
48+
49+ # An empty /tmp/graylog.tgz file indicates that we don't use a
50+ # custom LOCAL_BUILD_TGZ file.
51+ RUN if [ -f "/tmp/graylog.tgz" ] && [ -s "/tmp/graylog.tgz" ]; then \
52+ mkdir /opt/graylog && \
53+ tar --extract --gzip --file "/tmp/graylog.tgz" --strip-components=1 --directory /opt/graylog; \
54+ rm -rf /tmp/graylog.tgz; \
55+ fi
2556
2657RUN \
2758 install \
@@ -134,7 +165,7 @@ HEALTHCHECK \
134165
135166LABEL maintainer="Graylog, Inc. <hello@graylog.com>" \
136167 org.label-schema.name="Graylog Docker Image" \
137- org.label-schema.description="Official Graylog Docker image " \
168+ org.label-schema.description="Official Graylog Docker Image " \
138169 org.label-schema.url="https://www.graylog.org/" \
139170 org.label-schema.vcs-ref=${VCS_REF} \
140171 org.label-schema.vcs-url="https://github.com/Graylog2/graylog-docker" \
0 commit comments