bce313409d769f60051518d9d153487518aed65a
[policy/docker.git] / policy-db-migrator / src / main / docker / suse.Dockerfile
1 #-------------------------------------------------------------------------------
2 # Dockerfile
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2022 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 opensuse/leap:15.4
22
23 LABEL maintainer="Policy Team"
24 LABEL org.opencontainers.image.title="Policy db-migrator"
25 LABEL org.opencontainers.image.description="Policy db-migrator image based on OpenSuse"
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/lib64/jvm/java-11-openjdk-11
34 ENV POLICY_ETC /opt/app/policy/etc
35 ENV POLICY_PROFILE /opt/app/policy/etc/profile.d
36 ENV POLICY_BIN /opt/app/policy/bin
37
38 RUN zypper -n -q install --no-recommends cpio findutils mariadb-client netcat-openbsd postgresql util-linux && \
39     zypper -n -q update && \
40     zypper -n -q clean --all && \
41     groupadd --system policy && \
42     useradd --system --shell /bin/sh -G policy policy && \
43     mkdir -p $POLICY_PROFILE $POLICY_BIN && \
44     chown -R policy:policy $POLICY_ETC $POLICY_BIN
45
46 COPY --chown=policy:policy ./env.sh $POLICY_PROFILE/
47 COPY --chown=policy:policy ./db-migrator $POLICY_BIN/
48 COPY --chown=policy:policy ./db-migrator-pg $POLICY_BIN/
49 COPY --chown=policy:policy ./prepare_upgrade.sh $POLICY_BIN/
50 COPY --chown=policy:policy ./prepare_downgrade.sh $POLICY_BIN/
51 COPY --chown=policy:policy ./config/policyadmin/sql /home/policy/sql
52 COPY --chown=policy:policy ./config/policyadmin/postgres /home/policy/postgres
53
54 WORKDIR $POLICY_BIN
55 USER policy:policy