Jack Lucas | bad7720 | 2020-02-03 18:21:29 -0500 | [diff] [blame] | 1 | # ============LICENSE_START======================================================= |
| 2 | # org.onap.dcae |
| 3 | # ================================================================================ |
| 4 | # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. |
| 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 | # ============LICENSE_END========================================================= |
| 18 | |
| 19 | FROM centos:7.4.1708 |
| 20 | LABEL maintainer="maintainer" |
| 21 | |
| 22 | ENV DCAE_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }} |
| 23 | ENV CCSDK_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }} |
| 24 | ENV BP_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases }} |
| 25 | |
| 26 | # Install gcc |
| 27 | RUN yum install -y gcc python-devel |
| 28 | |
| 29 | # Install Consul |
| 30 | RUN yum install -y unzip \ |
| 31 | && mkdir -p /opt/consul/bin \ |
| 32 | && mkdir -p /opt/consul/data \ |
| 33 | && mkdir -p /opt/consul/config \ |
| 34 | && curl -Ssf https://releases.hashicorp.com/consul/1.2.1/consul_1.2.1_linux_amd64.zip > /tmp/consul.zip \ |
| 35 | && unzip -pj /tmp/consul.zip > /opt/consul/bin/consul \ |
| 36 | && chmod +x /opt/consul/bin/consul |
| 37 | COPY config/00-consul.json /opt/consul/config/ |
| 38 | |
| 39 | # Install jq |
| 40 | RUN curl -Ssf -L "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" > /bin/jq \ |
| 41 | && chmod +x /bin/jq |
| 42 | |
| 43 | # Install pip and Cloudify CLI (stay at version 4.2 because of changes in higher versions) |
| 44 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ |
| 45 | && python get-pip.py \ |
| 46 | && rm get-pip.py \ |
| 47 | && pip install cloudify==4.2 |
| 48 | |
| 49 | # Copy scripts |
| 50 | RUN mkdir scripts |
| 51 | COPY scripts/ /scripts |
| 52 | |
| 53 | # Get plugins from raw repos |
| 54 | RUN scripts/load-plugins.sh ${DCAE_REPO} ${CCSDK_REPO} \ |
| 55 | && rm scripts/load-plugins.sh \ |
| 56 | # Make sure scripts are executable |
| 57 | && chmod +x /scripts/*.sh |
| 58 | |
| 59 | # Load blueprints and input templates |
| 60 | COPY blueprints/ /blueprints |
| 61 | |
| 62 | # Set up runtime script |
| 63 | ENTRYPOINT exec "/scripts/bootstrap.sh" |
Jack Lucas | 879dbd6 | 2020-03-04 11:06:57 -0500 | [diff] [blame^] | 64 | |
| 65 | # Set up a non-root user |
| 66 | RUN mkdir -p /opt/bootstrap \ |
| 67 | && useradd -d /opt/bootstrap bootstrap \ |
| 68 | && chown -R bootstrap:bootstrap /opt/bootstrap \ |
| 69 | && chown -R bootstrap:bootstrap /scripts \ |
| 70 | && chown -R bootstrap:bootstrap /blueprints \ |
| 71 | && chown -R bootstrap:bootstrap /opt/consul |
| 72 | USER bootstrap |