1 # ============LICENSE_START=======================================================
2 # Copyright (C) 2019 Tieto. All rights reserved.
3 # Modifications Copyright (C) 2020, 2021 AT&T Intellectual Property. All rights reserved.
4 # Modifications Copyright (C) 2020, 2022-2023 Nordix Foundation.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
23 LABEL maintainer="Policy Team"
24 LABEL org.opencontainers.image.title="Policy JRE Alpine"
25 LABEL org.opencontainers.image.description="Policy Java 17 JRE image based on Alpine"
26 LABEL org.opencontainers.image.url="https://github.com/onap/policy-docker"
27 LABEL org.opencontainers.image.vendor="ONAP Policy Team"
28 LABEL org.opencontainers.image.licenses="Apache-2.0"
29 LABEL org.opencontainers.image.created="${git.build.time}"
30 LABEL org.opencontainers.image.version="${git.build.version}"
31 LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}"
33 ENV JAVA_HOME /usr/lib/jvm/default-jvm
34 ENV JAVA_OPTS="-Xms256m -Xmx1g"
36 ENV PYTHONUNBUFFERED=1
37 ENV POLICY_HOME=/opt/app/policy
38 ENV PATH $JAVA_HOME/bin:$PATH
43 # Default to UTF-8 file.encoding
44 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
55 rm -rf /var/cache/apk/* && \
57 addgroup -S $group && \
58 adduser -G $group -D $user && \
59 mkdir /var/log/$user && \
61 chown -R $user:$group /var/log/$user && \
62 chown -R $user:$group /app && \
63 # Policy Framework additions
73 rm -rf /var/cache/apk/* && \
74 addgroup -S policy && \
75 adduser -S --shell /bin/sh -G policy policy && \
76 mkdir -p ${POLICY_HOME}/ && \
77 chown policy:policy ${POLICY_HOME} && \
78 mkdir -p /usr/lib/jvm/ && \
79 ln -s /opt/java/openjdk /usr/lib/jvm/default-jvm && \
80 python3 -m ensurepip && \
81 pip3 install --no-cache --upgrade pip setuptools
84 RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
85 RUN python3 -m ensurepip
86 RUN pip3 install --no-cache --upgrade pip setuptools
89 # Tell docker that all future commands should be run as the onap user