ee315ed1bf63f7303f04e9061b7d9a2e80a20230
[policy/api.git] / packages / policy-api-docker / src / main / docker / Dockerfile
1 #-------------------------------------------------------------------------------
2 # Dockerfile
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
5 #  Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
21 #-------------------------------------------------------------------------------
22 FROM onap/policy-jre-alpine:2.4.3
23
24 LABEL maintainer="Policy Team"
25
26 ARG POLICY_LOGS=/var/log/onap/policy/api
27
28 ENV POLICY_LOGS=$POLICY_LOGS
29 ENV POLICY_HOME=$POLICY_HOME/api
30
31 RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
32     chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
33     mkdir /packages
34 COPY /maven/lib/policy-api.tar.gz /packages
35 RUN tar xvfz /packages/policy-api.tar.gz --directory $POLICY_HOME && \
36     rm /packages/policy-api.tar.gz
37
38 WORKDIR $POLICY_HOME
39 COPY policy-api.sh  bin/.
40 COPY /maven/api.jar /app
41
42 RUN chown -R policy:policy * && chmod 755 bin/*.sh && chown -R policy:policy /app
43
44 USER policy
45 WORKDIR $POLICY_HOME/bin
46 ENTRYPOINT [ "./policy-api.sh" ]