OCI image spec labels for API
[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 #  Modifications Copyright (C) 2022 Nordix Foundation.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #      http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #
20 # SPDX-License-Identifier: Apache-2.0
21 # ============LICENSE_END=========================================================
22 #-------------------------------------------------------------------------------
23 FROM onap/policy-jre-alpine:2.4.3
24
25 LABEL maintainer="Policy Team"
26 LABEL org.opencontainers.image.title="Policy API"
27 LABEL org.opencontainers.image.description="Policy API image based on Alpine"
28 LABEL org.opencontainers.image.url="https://github.com/onap/policy-api"
29 LABEL org.opencontainers.image.vendor="ONAP Policy Team"
30 LABEL org.opencontainers.image.licenses="Apache-2.0"
31 LABEL org.opencontainers.image.created="${git.build.time}"
32 LABEL org.opencontainers.image.version="${git.build.version}"
33 LABEL org.opencontainers.image.revision="${git.commit.id.abbrev}"
34
35 ARG POLICY_LOGS=/var/log/onap/policy/api
36
37 ENV POLICY_LOGS=$POLICY_LOGS
38 ENV POLICY_HOME=$POLICY_HOME/api
39
40 RUN mkdir -p $POLICY_LOGS $POLICY_HOME $POLICY_HOME/bin && \
41     chown -R policy:policy $POLICY_HOME $POLICY_LOGS && \
42     mkdir /packages
43 COPY /maven/lib/policy-api.tar.gz /packages
44 RUN tar xvfz /packages/policy-api.tar.gz --directory $POLICY_HOME && \
45     rm /packages/policy-api.tar.gz
46
47 WORKDIR $POLICY_HOME
48 COPY policy-api.sh  bin/.
49 COPY /maven/api.jar /app
50
51 RUN chown -R policy:policy * && chmod 755 bin/*.sh && chown -R policy:policy /app
52
53 USER policy
54 WORKDIR $POLICY_HOME/bin
55 ENTRYPOINT [ "./policy-api.sh" ]