c4a4b06353723b4ae94f0c02e35a7f8121cee1ee
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / Dockerfile
1 ##
2 ## Copyright (c) 2019 Intel Corporation
3 ##
4 ## Licensed under the Apache License, Version 2.0 (the "License");
5 ## you may not use this file except in compliance with the License.
6 ## You may obtain a copy of the License at
7 ##
8 ##     http://www.apache.org/licenses/LICENSE-2.0
9 ##
10 ## Unless required by applicable law or agreed to in writing, software
11 ## distributed under the License is distributed on an "AS IS" BASIS,
12 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ## See the License for the specific language governing permissions and
14 ## limitations under the License.
15 ##
16
17 ##################################################
18 # Build all components in separate builder image #
19 ##################################################
20 FROM centos:7 as builder
21
22 ARG BUILD_DIR=/opt/rapid
23
24 COPY ./port_info ${BUILD_DIR}/port_info
25
26 COPY ./deploycentostools.sh ${BUILD_DIR}/
27 RUN chmod +x ${BUILD_DIR}/deploycentostools.sh \
28   && ${BUILD_DIR}/deploycentostools.sh -k deploy
29
30 #############################
31 # Create slim runtime image #
32 #############################
33 FROM centos:7
34
35 ARG BUILD_DIR=/opt/rapid
36
37 COPY ./deploycentostools.sh ${BUILD_DIR}/
38 COPY --from=builder ${BUILD_DIR}/install_components.tgz ${BUILD_DIR}/install_components.tgz
39
40 RUN chmod a+rwx ${BUILD_DIR} && chmod +x ${BUILD_DIR}/deploycentostools.sh \
41  && ${BUILD_DIR}/deploycentostools.sh -k runtime_image
42
43 # Expose SSH and PROX ports
44 EXPOSE 22 8474
45
46 # Copy SSH keys
47 COPY ./rapid_rsa_key.pub /home/centos/.ssh/authorized_keys
48 COPY ./rapid_rsa_key.pub /root/.ssh/authorized_keys
49
50 # Copy startup script
51 COPY ./start.sh /start.sh
52 RUN chmod +x /start.sh
53
54 ENTRYPOINT ["/start.sh"]