Skip to content

Commit 555e0c7

Browse files
committed
use pyenv and allow alt checkouts
1 parent 765c16b commit 555e0c7

File tree

9 files changed

+153
-54
lines changed

9 files changed

+153
-54
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ __pycache__/
77
*.py[cod]
88
*$py.class
99

10+
# patch detritus
11+
*.rej
12+
*.orig
13+
1014
# C extensions
1115
*.so
1216

pkg/amazonlinux2016.09/Dockerfile

+18-7
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,22 @@ RUN mkdir -p "$LIBGIT2TEMP" \
136136
&& make \
137137
&& make install
138138

139-
#pyinstaller requirements start
140-
#must be preceded by libgit2 install
139+
# use pyenv
141140
COPY pyinstaller-requirements.txt /
142-
#default python-pip from yum does not like upgrading itself from pip. looking for better options other than wget.
143-
RUN wget -c https://bootstrap.pypa.io/get-pip.py \
144-
&& python get-pip.py \
141+
ARG PYENV_VERSION=3.6.10
142+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
143+
ENV PYENV_ROOT=/usr/local/pyenv
144+
ENV PATH=$PYENV_ROOT/bin:$PATH
145+
RUN umask 022 \
146+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
147+
&& chmod 0755 /usr/bin/pyenv-installer \
148+
&& /usr/bin/pyenv-installer \
149+
&& eval "$(pyenv init -)" \
150+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
151+
&& pyenv global $PYENV_VERSION
152+
153+
RUN eval "$(pyenv init -)" \
154+
&& pip -v install --upgrade pip \
145155
&& pip -v install -r pyinstaller-requirements.txt
146156

147157
#fpm package making requirements start
@@ -151,7 +161,7 @@ RUN yum install -y ruby ruby-devel rpmbuild rpm-build rubygems gcc make \
151161
#pyinstaller start
152162
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
153163
#use the following variables to choose the version of hubble
154-
ENV HUBBLE_CHECKOUT=v3.0.8
164+
ARG HUBBLE_CHECKOUT=v3.0.8
155165
ENV HUBBLE_VERSION=3.0.8
156166
ENV HUBBLE_ITERATION=1
157167
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
@@ -165,7 +175,7 @@ ENV _INCLUDE_PATH=""
165175
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
166176
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
167177
&& cd "$HUBBLE_SRC_PATH" \
168-
&& git checkout "$HUBBLE_CHECKOUT" \
178+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
169179
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
170180
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
171181
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -174,6 +184,7 @@ VOLUME /data
174184
WORKDIR /hubble_build
175185
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
176186
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
187+
&& eval \"$(pyenv init -)\" \
177188
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
178189
&& mkdir -p /var/log/hubble_osquery/backuplogs \
179190
# hubble default configuration file

pkg/centos6/Dockerfile

+20-12
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,23 @@ RUN mkdir -p "$LIBGIT2TEMP" \
135135
&& make \
136136
&& make install
137137

138-
#pyinstaller requirements start
139-
#must be preceded by libgit2 install
138+
# use pyenv
140139
COPY pyinstaller-requirements.txt /
141-
#default python-pip from yum does not like upgrading itself from pip. looking for better options other than wget.
142-
RUN wget -c https://bootstrap.pypa.io/get-pip.py \
143-
&& yum -y install centos-release-scl \
144-
&& yum -y install python27 \
145-
&& chmod u+x ./get-pip.py \
146-
&& scl enable python27 "./get-pip.py" \
147-
&& scl enable python27 "pip -v install -r pyinstaller-requirements.txt"
140+
ARG PYENV_VERSION=3.6.10
141+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
142+
ENV PYENV_ROOT=/usr/local/pyenv
143+
ENV PATH=$PYENV_ROOT/bin:$PATH
144+
RUN umask 022 \
145+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
146+
&& chmod 0755 /usr/bin/pyenv-installer \
147+
&& /usr/bin/pyenv-installer \
148+
&& eval "$(pyenv init -)" \
149+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
150+
&& pyenv global $PYENV_VERSION
151+
152+
RUN eval "$(pyenv init -)" \
153+
&& pip -v install --upgrade pip \
154+
&& pip -v install -r pyinstaller-requirements.txt
148155

149156
#fpm package making requirements start
150157
RUN yum install -y rpmbuild rpm-build gcc make rh-ruby23 rh-ruby23-ruby-devel \
@@ -153,7 +160,7 @@ RUN yum install -y rpmbuild rpm-build gcc make rh-ruby23 rh-ruby23-ruby-devel \
153160
#pyinstaller start
154161
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
155162
#use the following variables to choose the version of hubble
156-
ENV HUBBLE_CHECKOUT=v3.0.8
163+
ARG HUBBLE_CHECKOUT=v3.0.8
157164
ENV HUBBLE_VERSION=3.0.8
158165
ENV HUBBLE_ITERATION=1
159166
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
@@ -167,7 +174,7 @@ ENV _INCLUDE_PATH=""
167174
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
168175
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
169176
&& cd "$HUBBLE_SRC_PATH" \
170-
&& git checkout "$HUBBLE_CHECKOUT" \
177+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
171178
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
172179
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
173180
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -176,7 +183,8 @@ VOLUME /data
176183
WORKDIR /hubble_build
177184
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
178185
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
179-
&& scl enable python27 'pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py' \
186+
&& eval \"$(pyenv init -)\" \
187+
&& python27 'pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py' \
180188
&& mkdir -p /var/log/hubble_osquery/backuplogs \
181189
# hubble default configuration file
182190
&& cp -rf /hubble_build/conf/hubble /etc/hubble/ \

pkg/centos7/Dockerfile

+18-7
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,22 @@ RUN mkdir -p "$LIBGIT2TEMP" \
134134
&& make \
135135
&& make install
136136

137-
#pyinstaller requirements start
138-
#must be preceded by libgit2 install
137+
# use pyenv
139138
COPY pyinstaller-requirements.txt /
140-
#default python-pip from yum does not like upgrading itself from pip. looking for better options other than wget.
141-
RUN wget -c https://bootstrap.pypa.io/get-pip.py \
142-
&& python get-pip.py \
139+
ARG PYENV_VERSION=3.6.10
140+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
141+
ENV PYENV_ROOT=/usr/local/pyenv
142+
ENV PATH=$PYENV_ROOT/bin:$PATH
143+
RUN umask 022 \
144+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
145+
&& chmod 0755 /usr/bin/pyenv-installer \
146+
&& /usr/bin/pyenv-installer \
147+
&& eval "$(pyenv init -)" \
148+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
149+
&& pyenv global $PYENV_VERSION
150+
151+
RUN eval "$(pyenv init -)" \
152+
&& pip -v install --upgrade pip \
143153
&& pip -v install -r pyinstaller-requirements.txt
144154

145155
#fpm package making requirements start
@@ -149,7 +159,7 @@ RUN yum install -y ruby ruby-devel rpmbuild rpm-build rubygems gcc make \
149159
#pyinstaller start
150160
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
151161
#use the following variables to choose the version of hubble
152-
ENV HUBBLE_CHECKOUT=v3.0.8
162+
ARG HUBBLE_CHECKOUT=v3.0.8
153163
ENV HUBBLE_VERSION=3.0.8
154164
ENV HUBBLE_ITERATION=1
155165
ENV HUBBLE_URL=https://github.com/hubblestack/hubble
@@ -163,7 +173,7 @@ ENV _INCLUDE_PATH=""
163173
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
164174
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
165175
&& cd "$HUBBLE_SRC_PATH" \
166-
&& git checkout "$HUBBLE_CHECKOUT" \
176+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
167177
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
168178
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
169179
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -172,6 +182,7 @@ VOLUME /data
172182
WORKDIR /hubble_build
173183
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
174184
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
185+
&& eval \"$(pyenv init -)\" \
175186
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
176187
&& mkdir -p /var/log/hubble_osquery/backuplogs \
177188
# hubble default configuration file

pkg/coreos/Dockerfile

+19-5
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,28 @@ RUN mkdir -p "$LIBGIT2TEMP" \
152152
&& make \
153153
&& make install
154154

155-
#pyinstaller requirements start
156-
#must be preceded by libgit2 install
155+
+# use pyenv
157156
COPY pyinstaller-requirements.txt /
158-
RUN pip -v install -r pyinstaller-requirements.txt
157+
ARG PYENV_VERSION=3.6.10
158+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
159+
ENV PYENV_ROOT=/usr/local/pyenv
160+
ENV PATH=$PYENV_ROOT/bin:$PATH
161+
RUN umask 022 \
162+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
163+
&& chmod 0755 /usr/bin/pyenv-installer \
164+
&& /usr/bin/pyenv-installer \
165+
&& eval "$(pyenv init -)" \
166+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
167+
&& pyenv global $PYENV_VERSION
168+
169+
RUN eval "$(pyenv init -)" \
170+
&& pip -v install --upgrade pip \
171+
&& pip -v install -r pyinstaller-requirements.txt
159172

160173
#pyinstaller start
161174
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
162175
#use the following variables to choose the version of hubble
163-
ENV HUBBLE_CHECKOUT=v3.0.8
176+
ARG HUBBLE_CHECKOUT=v3.0.8
164177
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
165178
ENV HUBBLE_VERSION=3.0.8
166179
ENV HUBBLE_ITERATION=1
@@ -170,7 +183,7 @@ ENV _BINARY_LOG_LEVEL="INFO"
170183
ENV _INCLUDE_PATH=""
171184
RUN git clone ${HUBBLE_GIT_URL} "$HUBBLE_SRC_PATH" \
172185
&& cd "$HUBBLE_SRC_PATH" \
173-
&& git checkout ${HUBBLE_CHECKOUT} \
186+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
174187
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
175188
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
176189
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -179,6 +192,7 @@ VOLUME /data
179192
WORKDIR /hubble_build
180193
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
181194
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
195+
&& eval \"$(pyenv init -)\" \
182196
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
183197
&& mkdir -p /var/log/hubble_osquery/backuplogs \
184198
# hubble default configuration file

pkg/debian10/Dockerfile

+19-5
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,23 @@ RUN mkdir -p "$LIBGIT2TEMP" \
152152
&& make \
153153
&& make install
154154

155-
#pyinstaller requirements start
156-
#must be preceded by libgit2 install
155+
# use pyenv
157156
COPY pyinstaller-requirements.txt /
158-
RUN pip -v install -r pyinstaller-requirements.txt
157+
ARG PYENV_VERSION=3.6.10
158+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
159+
ENV PYENV_ROOT=/usr/local/pyenv
160+
ENV PATH=$PYENV_ROOT/bin:$PATH
161+
RUN umask 022 \
162+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
163+
&& chmod 0755 /usr/bin/pyenv-installer \
164+
&& /usr/bin/pyenv-installer \
165+
&& eval "$(pyenv init -)" \
166+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
167+
&& pyenv global $PYENV_VERSION
168+
169+
RUN eval "$(pyenv init -)" \
170+
&& pip -v install --upgrade pip \
171+
&& pip -v install -r pyinstaller-requirements.txt
159172

160173
#deb package making requirements start
161174
RUN apt-get install -y ruby ruby-dev rubygems gcc make \
@@ -164,7 +177,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
164177
#pyinstaller start
165178
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
166179
#use the following variables to choose the version of hubble
167-
ENV HUBBLE_CHECKOUT=v3.0.8
180+
ARG HUBBLE_CHECKOUT=v3.0.8
168181
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
169182
ENV HUBBLE_VERSION=3.0.8
170183
ENV HUBBLE_ITERATION=1
@@ -176,7 +189,7 @@ ENV _INCLUDE_PATH=""
176189
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
177190
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
178191
&& cd "$HUBBLE_SRC_PATH" \
179-
&& git checkout "$HUBBLE_CHECKOUT" \
192+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
180193
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
181194
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
182195
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -185,6 +198,7 @@ VOLUME /data
185198
WORKDIR /hubble_build
186199
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
187200
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
201+
&& eval \"$(pyenv init -)\" \
188202
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
189203
&& mkdir -p /var/log/hubble_osquery/backuplogs \
190204
# hubble default configuration file

pkg/debian7/Dockerfile

+18-6
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,22 @@ RUN mkdir -p "$LIBGIT2TEMP" \
173173
&& make \
174174
&& make install
175175

176-
#pyinstaller requirements start
177-
#must be preceded by libgit2 install
176+
# use pyenv
178177
COPY pyinstaller-requirements.txt /
179-
RUN wget -c https://bootstrap.pypa.io/get-pip.py \
180-
&& python get-pip.py \
178+
ARG PYENV_VERSION=3.6.10
179+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
180+
ENV PYENV_ROOT=/usr/local/pyenv
181+
ENV PATH=$PYENV_ROOT/bin:$PATH
182+
RUN umask 022 \
183+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
184+
&& chmod 0755 /usr/bin/pyenv-installer \
185+
&& /usr/bin/pyenv-installer \
186+
&& eval "$(pyenv init -)" \
187+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
188+
&& pyenv global $PYENV_VERSION
189+
190+
RUN eval "$(pyenv init -)" \
191+
&& pip -v install --upgrade pip \
181192
&& pip -v install -r pyinstaller-requirements.txt
182193

183194
#deb package making requirements start
@@ -187,7 +198,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
187198
#pyinstaller start
188199
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
189200
#use the following variables to choose the version of hubble
190-
ENV HUBBLE_CHECKOUT=v3.0.8
201+
ARG HUBBLE_CHECKOUT=v3.0.8
191202
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
192203
ENV HUBBLE_VERSION=3.0.8
193204
ENV HUBBLE_ITERATION=1
@@ -199,7 +210,7 @@ ENV _INCLUDE_PATH=""
199210
ENV LD_LIBRARY_PATH=/opt/hubble/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
200211
RUN git clone ${HUBBLE_GIT_URL} "$HUBBLE_SRC_PATH" \
201212
&& cd "$HUBBLE_SRC_PATH" \
202-
&& git checkout ${HUBBLE_CHECKOUT} \
213+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
203214
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
204215
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
205216
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -208,6 +219,7 @@ VOLUME /data
208219
WORKDIR /hubble_build
209220
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
210221
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
222+
&& eval \"$(pyenv init -)\" \
211223
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
212224
&& mkdir -p /var/log/hubble_osquery/backuplogs \
213225
# hubble default configuration file

pkg/debian8/Dockerfile

+18-7
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,22 @@ RUN mkdir -p "$LIBGIT2TEMP" \
154154
&& make \
155155
&& make install
156156

157-
#pyinstaller requirements start
158-
#must be preceded by libgit2 install
157+
# use pyenv
159158
COPY pyinstaller-requirements.txt /
160-
#default python-pip from yum does not like upgrading itself from pip. looking for better options other than wget.
161-
RUN wget -c https://bootstrap.pypa.io/get-pip.py \
162-
&& python get-pip.py \
159+
ARG PYENV_VERSION=3.6.10
160+
ENV PYENV_INSTALLER_URL=https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer
161+
ENV PYENV_ROOT=/usr/local/pyenv
162+
ENV PATH=$PYENV_ROOT/bin:$PATH
163+
RUN umask 022 \
164+
&& curl -s -S -L "$PYENV_INSTALLER_URL" -o /usr/bin/pyenv-installer \
165+
&& chmod 0755 /usr/bin/pyenv-installer \
166+
&& /usr/bin/pyenv-installer \
167+
&& eval "$(pyenv init -)" \
168+
&& env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install $PYENV_VERSION \
169+
&& pyenv global $PYENV_VERSION
170+
171+
RUN eval "$(pyenv init -)" \
172+
&& pip -v install --upgrade pip \
163173
&& pip -v install -r pyinstaller-requirements.txt
164174

165175
#deb package making requirements start
@@ -169,7 +179,7 @@ RUN apt-get install -y ruby ruby-dev rubygems gcc make \
169179
#pyinstaller start
170180
#commands specified for ENTRYPOINT and CMD are executed when the container is run, not when the image is built
171181
#use the following variables to choose the version of hubble
172-
ENV HUBBLE_CHECKOUT=v3.0.8
182+
ARG HUBBLE_CHECKOUT=v3.0.8
173183
ENV HUBBLE_GIT_URL=https://github.com/hubblestack/hubble.git
174184
ENV HUBBLE_VERSION=3.0.8
175185
ENV HUBBLE_ITERATION=1
@@ -180,7 +190,7 @@ ENV _BINARY_LOG_LEVEL="INFO"
180190
ENV _INCLUDE_PATH=""
181191
RUN git clone "$HUBBLE_GIT_URL" "$HUBBLE_SRC_PATH" \
182192
&& cd "$HUBBLE_SRC_PATH" \
183-
&& git checkout "$HUBBLE_CHECKOUT" \
193+
&& git checkout -B hubble-build && git reset --hard "$HUBBLE_CHECKOUT" && git clean -dfx \
184194
&& cp -rf "$HUBBLE_SRC_PATH" /hubble_build \
185195
&& sed -i "s/BRANCH_NOT_SET/${HUBBLE_CHECKOUT}/g" /hubble_build/hubblestack/__init__.py \
186196
&& sed -i "s/COMMIT_NOT_SET/`git describe`/g" /hubble_build/hubblestack/__init__.py
@@ -189,6 +199,7 @@ VOLUME /data
189199
WORKDIR /hubble_build
190200
ENTRYPOINT [ "/bin/bash", "-o", "xtrace", "-c" ]
191201
CMD [ "if [ -f /data/hubble_buildinfo ] ; then echo \"\" >> /hubble_build/hubblestack/__init__.py ; cat /data/hubble_buildinfo >> /hubble_build/hubblestack/__init__.py; fi \
202+
&& eval \"$(pyenv init -)\" \
192203
&& pyinstaller --onedir --noconfirm --log-level ${_BINARY_LOG_LEVEL} --additional-hooks-dir=${_HOOK_DIR} --runtime-hook=pkg/pyinstaller-runtimehooks/pathopthubble.py hubble.py \
193204
&& mkdir -p /var/log/hubble_osquery/backuplogs \
194205
# hubble default configuration file

0 commit comments

Comments
 (0)