aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorAlexander Mazuruk <a.mazuruk@samsung.com>2021-02-18 17:24:44 +0100
committerAlexander Mazuruk <a.mazuruk@samsung.com>2021-05-11 01:27:00 +0200
commite22e10e5aa858fe36db2580e072e5b53957117e9 (patch)
tree1560e4dc52ecf9835b34a10bc1f4415b68b2934f /Dockerfile
parent031694bad1802a75918b9b97d5c34faac729f0c6 (diff)
Change python baseOS img to integration-python2.2.0
Moved setting PYTHONPATH and PATH to Dockerfile as thats where python version is defined (baseOS image) Switched hardcoded python3.8 to python3. psycopg is recommended to be built from source for production use, yet CI environment does not have the dependencies to build it. To circumvent that, requirements were split into: - requirements-common.txt that should be included for each environment - requirements-docker.txt that force building of psycopg in docker - requirements.txt that use psycopg-binary for ci purposes Benefits from switching over: * minimal {java11,python} images maintained by integration team * using currently "blessed by seccom" versions (:latest tag used) * should limit spread of legal issues across layers * integration images will be the first to have automated compliance documentation * should limit spread of base layers (contributing to deployment footprint - more base layers = more to download, more to store etc...) Issue-ID: INT-1864 Issue-ID: DCAEGEN2-2420 Signed-off-by: Alexander Mazuruk <a.mazuruk@samsung.com> Change-Id: I77be2fd9dd53613a1a6ad26f8f0b506073f1cca6
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile74
1 files changed, 34 insertions, 40 deletions
diff --git a/Dockerfile b/Dockerfile
index fee54d1..2ff1e7a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,57 +1,51 @@
-FROM python:3.8.2-alpine3.11
-MAINTAINER gs244f@att.com
+FROM nexus3.onap.org:10001/onap/integration-python:8.0.0
+LABEL maintainer="gs244f@att.com"
-ARG user=onap
-ARG group=onap
+ARG user=heartbeat
+ARG group=heartbeat
+USER root
RUN addgroup -S $group && adduser -S -D -h /home/$user $user $group && \
chown -R $user:$group /home/$user && \
- mkdir /var/log/$user && \
+ mkdir -p /var/log/$user && \
chown -R $user:$group /var/log/$user && \
- mkdir /app && \
+ mkdir -p /app && \
chown -R $user:$group /app
-
-WORKDIR /app
-#ADD . /tmp
-#RUN mkdir /tmp/config
+WORKDIR /app
EXPOSE 10002
-COPY ./miss_htbt_service/ ./bin/
-COPY ./etc/ ./etc/
-COPY requirements.txt ./
-COPY setup.py ./
-
-#need pip > 8 to have internal pypi repo in requirements.txt
-#do the install
-RUN apk add build-base libffi-dev postgresql-dev && \
+COPY --chown=$user:$group ./miss_htbt_service/ ./bin/
+COPY --chown=$user:$group ./etc/ ./etc/
+COPY --chown=$user:$group requirements-common.txt ./
+COPY --chown=$user:$group requirements-docker.txt ./
+COPY --chown=$user:$group setup.py ./
+
+# install build dependencies for python packages,
+# install python packages
+# remove build dependencies
+RUN apk add --no-cache --virtual build-deps \
+ build-base libffi-dev postgresql-dev \
+ openssl-dev musl-dev python3-dev curl && \
+ apk add --no-cache libpq && \
+ curl https://sh.rustup.rs -sSf | sh -s -- -y && \
+ export PATH="$HOME/.cargo/bin/:$PATH" && \
+ source $HOME/.cargo/env && \
pip install --upgrade pip && \
- pip install pyyaml --upgrade && \
- pip install -r requirements.txt && \
- pip install -e .
-
-RUN mkdir -p data \
- && mkdir -p logs \
- && mkdir -p tmp \
- && chown -R $user:$group . \
- && chmod a+w data \
- && chmod a+w logs \
- && chmod a+w tmp \
- && chmod a+w etc \
- && chmod 500 bin/*.py \
- && chmod 500 bin/*.sh \
- && chmod 500 bin/*/*.py
+ pip install -r requirements-docker.txt && \
+ mkdir -p data logs tmp && \
+ chown -R $user:$group . && \
+ chmod g+w data logs tmp etc && \
+ chmod -R 500 bin/*.py && \
+ chmod 500 bin/*.sh && \
+ apk del build-deps && \
+ rustup self uninstall -y
USER $user
VOLUME logs
CMD ["./bin/misshtbt.sh"]
-#ENV PYTHONPATH="/usr/local/lib/python3.6:/usr/local/lib/python3.6/site-packages:${PATH}"
-#ENV PYTHONPATH="/usr/local/lib/python3.6/site-packages:/usr/local/lib/python3.6"
-#ENV PYTHONPATH=/usr/local/lib/python3.6/site-packages:.
-#ENTRYPOINT ["/bin/python", "./bin/run.py"]
-#ENTRYPOINT ["/usr/bin/python","./bin/run.py" ]
-#ENTRYPOINT ["/usr/local/bin/python","./bin/misshtbtd.py" ]
-#ENTRYPOINT ["/bin/ls","-lR", "."]
+ENV PYTHONPATH="$PYTHONPATH:/usr/local/lib/python3.9/site-packages:/app/bin:/app/bin/mod"
+ENV PATH="$PATH:/app/bin:/app/bin/mod"