Fix Postgres queries in clamp database migration
[policy/docker.git] / policy-jdk / alpine / src / main / docker / Dockerfile
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
9 #
10 #    http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 #   SPDX-License-Identifier: Apache-2.0
19 #   ============LICENSE_END=========================================================
20
21 FROM alpine:3.18.2
22
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}"
32
33 ENV JAVA_HOME /usr/lib/jvm/default-jvm
34 ENV JAVA_OPTS="-Xms256m -Xmx1g"
35 ENV JAVA_SEC_OPTS=""
36 ENV PYTHONUNBUFFERED=1
37 ENV POLICY_HOME=/opt/app/policy
38 ENV PATH $JAVA_HOME/bin:$PATH
39
40 ARG user=onap
41 ARG group=onap
42
43 # Default to UTF-8 file.encoding
44 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
45
46 # Generic additions
47 RUN apk update && \
48     apk add --no-cache \
49         libretls \
50         musl-locales \
51         musl-locales-lang \
52         openjdk17-jdk \
53         openssl \
54         ca-certificates && \
55     rm -rf /var/cache/apk/* && \
56 # ONAP additions
57     addgroup -S $group && \
58     adduser -G $group -D $user && \
59     mkdir /var/log/$user && \
60     mkdir /app && \
61     chown -R $user:$group /var/log/$user && \
62     chown -R $user:$group /app && \
63 # Policy Framework additions
64     apk update && \
65     apk add --no-cache \
66         busybox-extras \
67         curl \
68         jq \
69         procps \
70         unzip \
71         zip \
72         python3 && \
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
82
83 # Install python/pip
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
87
88
89 # Tell docker that all future commands should be run as the onap user
90 USER $user
91 WORKDIR /app