-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
172 lines (144 loc) · 6.75 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
ARG LENSES_BASE_VERSION=5.5
ARG LENSES_ARCHIVE=remote
ARG LENSES_VERSION=5.5.11
ARG LENSESCLI_ARCHIVE=remote
ARG LENSESCLI_VERSION=5.5.3
# This is the default image we use for installing Lenses
FROM alpine AS archive_remote
ONBUILD ARG AD_UN
ONBUILD ARG AD_PW
ONBUILD ARG LENSES_VERSION LENSES_BASE_VERSION
ONBUILD ARG AD_URL=https://archive.lenses.io/lenses/${LENSES_BASE_VERSION}/lenses-${LENSES_VERSION}-linux64.tar.gz
ONBUILD RUN apk add --no-cache wget \
&& echo "progress = dot:giga" | tee /etc/wgetrc \
&& mkdir -p /opt \
&& echo "$AD_URL $AD_FILENAME" \
&& if [ -z "$AD_URL" ]; then exit 0; fi && wget $AD_UN $AD_PW "$AD_URL" -O /lenses.tgz \
&& tar xf /lenses.tgz -C /opt \
&& rm /lenses.tgz
# This image gets Lenses from a local file instead of a remote URL
FROM alpine AS archive_local
ONBUILD ARG AD_FILENAME
ONBUILD RUN mkdir -p /opt
ONBUILD ADD $AD_FILENAME /opt
# This image gets a custom Lenses frontend from a local file
FROM archive_local AS archive_local_with_ui
ONBUILD ARG UI_FILENAME
ONBUILD ADD $UI_FILENAME /opt
ONBUILD RUN rm -rf /opt/lenses/ui \
&& mv /opt/dist /opt/lenses/ui \
&& sed \
-e "s/export LENSESUI_REVISION=.*/export LENSESUI_REVISION=$(cat /opt/lenses/ui/build.info | cut -f 2 -d ' ')/" \
-i /opt/lenses/bin/lenses
# This image is here to just trigger the build of any of the above 3 images
FROM archive_${LENSES_ARCHIVE} AS archive
# Add jmx_exporter
ARG FAST_DATA_AGENT_URL=https://archive.landoop.com/tools/fast_data_monitoring/fast_data_monitoring-2.2.tar.gz
RUN mkdir -p /opt/lensesio/ \
&& wget "$FAST_DATA_AGENT_URL" -O /fda.tgz \
&& tar xf /fda.tgz -C /opt/lensesio \
&& rm /fda.tgz
# This is the default image we use for installing lenses-cli
FROM alpine AS lenses_cli_remote
ONBUILD ARG CAD_UN
ONBUILD ARG CAD_PW
ONBUILD ARG LENSESCLI_VERSION LENSES_BASE_VERSION
ONBUILD ARG TARGETARCH TARGETOS
ONBUILD ARG LC_URL="https://archive.lenses.io/lenses/${LENSES_BASE_VERSION}/cli/lenses-cli-${TARGETOS}-${TARGETARCH}-${LENSESCLI_VERSION}.tar.gz"
ONBUILD RUN wget $CAD_UN $CAD_PW "$LC_URL" -O /lenses-cli.tgz \
&& tar xzf /lenses-cli.tgz --strip-components=1 -C /usr/bin/ lenses-cli-${TARGETOS}-${TARGETARCH}-$LENSESCLI_VERSION/lenses-cli \
&& rm -f /lenses-cli.tgz
# This image gets Lenses from a local file instead of a remote URL
FROM alpine AS lenses_cli_local
ONBUILD ARG LC_FILENAME
ONBUILD RUN mkdir -p /lenses-cli
ONBUILD COPY $LC_FILENAME /lenses-cli.tgz
ONBUILD RUN tar xzf /lenses-cli.tgz --strip-components=1 -C /usr/bin
# This image is here to just trigger the build of any of the above 3 images
ARG LENSESCLI_ARCHIVE
FROM lenses_cli_${LENSESCLI_ARCHIVE} AS lenses_cli
# The final Lenses image for compatibility with older versions
FROM debian:bullseye-slim AS lenses_debian
LABEL org.opencontainers.image.authors="Marios Andreopoulos <marios@lenses.io>"
LABEL org.opencontainers.image.ref.name="lensesio/lenses"
LABEL org.opencontainers.image.version=${LENSES_VERSION}
LABEL org.opencontainers.imave.vendor="Lenses.io"
# Update, install tooling and some basic setup
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
default-jre-headless \
dumb-init \
gosu \
&& rm -rf /var/lib/apt/lists/* \
&& echo 'export PS1="\[\033[1;31m\]\u\[\033[1;33m\]@\[\033[1;34m\]lenses \[\033[1;36m\]\W\[\033[1;0m\] $ "' \
| tee -a /root/.bashrc >> /etc/bash.bashrc \
&& mkdir -p /mnt/settings /mnt/secrets
ADD setup.sh debug-setup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/setup.sh /usr/local/bin/debug-setup.sh
COPY /filesystem /
# PLACEHOLDER: This line can be used to inject code if needed, please do not remove #
# Add Lenses
COPY --from=archive /opt /opt
# Add Lenses CLI
COPY --from=lenses_cli /usr/bin/lenses-cli /usr/bin/lenses-cli
ARG BUILD_BRANCH
ARG BUILD_COMMIT
ARG BUILD_TIME
ARG DOCKER_REPO=local
RUN grep 'export LENSES_REVISION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee /build.info \
&& grep 'export LENSESUI_REVISION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee -a /build.info \
&& grep 'export LENSES_VERSION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee -a /build.info \
&& echo "BUILD_BRANCH=${BUILD_BRANCH}" | tee -a /build.info \
&& echo "BUILD_COMMIT=${BUILD_COMMIT}" | tee -a /build.info \
&& echo "BUILD_TIME=${BUILD_TIME}" | tee -a /build.info \
&& echo "DOCKER_REPO=${DOCKER_REPO}" | tee -a /build.info
EXPOSE 9991
WORKDIR /
RUN mkdir -p /data /data/kafka-streams-state /data/log /data/plugins /data/storage \
&& chmod -R 777 /data
VOLUME ["/data/kafka-streams-state", "/data/log", "/data/plugins", "/data/storage"]
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/local/bin/setup.sh"]
# The final Lenses image
FROM ubuntu:22.04
ARG LENSES_VERSION
LABEL org.opencontainers.image.authors="Marios Andreopoulos <marios@lenses.io>"
LABEL org.opencontainers.image.ref.name="lensesio/lenses"
LABEL org.opencontainers.image.version=${LENSES_VERSION}
LABEL org.opencontainers.imave.vendor="Lenses.io"
# Update, install tooling and some basic setup
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
default-jre-headless \
dumb-init \
gosu \
&& rm -rf /var/lib/apt/lists/* \
&& echo 'export PS1="\[\033[1;31m\]\u\[\033[1;33m\]@\[\033[1;34m\]lenses \[\033[1;36m\]\W\[\033[1;0m\] $ "' \
| tee -a /root/.bashrc >> /etc/bash.bashrc \
&& mkdir -p /mnt/settings /mnt/secrets
ADD setup.sh debug-setup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/setup.sh /usr/local/bin/debug-setup.sh
COPY /filesystem /
# PLACEHOLDER: This line can be used to inject code if needed, please do not remove #
# Add Lenses
COPY --from=archive /opt /opt
# Add Lenses CLI
COPY --from=lenses_cli /usr/bin/lenses-cli /usr/bin/lenses-cli
ARG BUILD_BRANCH
ARG BUILD_COMMIT
ARG BUILD_TIME
ARG DOCKER_REPO=local
RUN grep 'export LENSES_REVISION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee /build.info \
&& grep 'export LENSESUI_REVISION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee -a /build.info \
&& grep 'export LENSES_VERSION' /opt/lenses/bin/lenses | sed -e 's/export //' | tee -a /build.info \
&& echo "BUILD_BRANCH=${BUILD_BRANCH}" | tee -a /build.info \
&& echo "BUILD_COMMIT=${BUILD_COMMIT}" | tee -a /build.info \
&& echo "BUILD_TIME=${BUILD_TIME}" | tee -a /build.info \
&& echo "DOCKER_REPO=${DOCKER_REPO}" | tee -a /build.info
EXPOSE 9991
WORKDIR /
RUN mkdir -p /data /data/kafka-streams-state /data/log /data/plugins /data/storage \
&& chmod -R 777 /data
VOLUME ["/data/kafka-streams-state", "/data/log", "/data/plugins", "/data/storage"]
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/local/bin/setup.sh"]