aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: 9a480fa6fdbb24eeb1ec799c45ad26acdcccce53 (plain)
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
FROM nexus3.onap.org:10001/onap/integration-python:8.0.0
LABEL maintainer="gs244f@att.com"

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 -p /var/log/$user && \
    chown -R $user:$group /var/log/$user && \
    mkdir -p /app && \
    chown -R $user:$group /app

WORKDIR /app

EXPOSE 10002

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 -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

CMD ["./bin/misshtbt.sh"]

ENV PYTHONPATH="$PYTHONPATH:/usr/local/lib/python3.9/site-packages:/app/bin:/app/bin/mod"
ENV PATH="$PATH:/app/bin:/app/bin/mod"