From 526e93e2dcac2b774ae19638b19a4dbd59e80b11 Mon Sep 17 00:00:00 2001 From: John Belisle Date: Sat, 7 Mar 2020 15:27:05 -0500 Subject: [PATCH] Make changes to Docker build to support python3. Make changes to Docker build to support python3. See https://github.com/bitsensor/elastalert/pull/157 --- Dockerfile | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 056ff5af..4085101c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:latest as py-ea -ARG ELASTALERT_VERSION=v0.2.0b2 +ARG ELASTALERT_VERSION=1334b611fdd7adf39991a1b0b11689568d612690 ENV ELASTALERT_VERSION=${ELASTALERT_VERSION} # URL from which to download Elastalert. ARG ELASTALERT_URL=https://github.com/Yelp/elastalert/archive/$ELASTALERT_VERSION.zip @@ -9,7 +9,7 @@ ENV ELASTALERT_HOME /opt/elastalert WORKDIR /opt -RUN apk add --update --no-cache ca-certificates openssl-dev openssl python2-dev python2 py2-pip py2-yaml libffi-dev gcc musl-dev wget && \ +RUN apk add --update --no-cache ca-certificates openssl-dev openssl python3-dev python3 py3-pip py3-yaml libffi-dev gcc musl-dev wget && \ # Download and unpack Elastalert. wget -O elastalert.zip "${ELASTALERT_URL}" && \ unzip elastalert.zip && \ @@ -19,19 +19,17 @@ RUN apk add --update --no-cache ca-certificates openssl-dev openssl python2-dev WORKDIR "${ELASTALERT_HOME}" # Install Elastalert. -# see: https://github.com/Yelp/elastalert/issues/1654 -RUN sed -i 's/jira>=1.0.10/jira>=1.0.10,<1.0.15/g' setup.py && \ - python setup.py install && \ - pip install -r requirements.txt +# With the latest hash we no longer need to monkey with package versions +RUN python3 setup.py install FROM node:alpine -LABEL maintainer="BitSensor " +LABEL maintainer="John Belisle " # Set timezone for this container -ENV TZ Etc/UTC +ENV TZ America/New_York -RUN apk add --update --no-cache curl tzdata python2 make libmagic - -COPY --from=py-ea /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages +RUN apk add --update --no-cache curl tzdata python3 make libmagic && \ + ln -s /usr/bin/python3 /usr/bin/python +COPY --from=py-ea /usr/lib/python3.8/site-packages /usr/lib/python3.8/site-packages COPY --from=py-ea /opt/elastalert /opt/elastalert COPY --from=py-ea /usr/bin/elastalert* /usr/bin/