2c25f09768d828e74c9677b4c5f7ffd365ed8d1c
[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 COPY --from=builder ${BUILD_DIR}/src ${BUILD_DIR}/src
40
41 RUN chmod a+rwx ${BUILD_DIR} && chmod +x ${BUILD_DIR}/deploycentostools.sh \
42  && ${BUILD_DIR}/deploycentostools.sh -k runtime_image
43
44 # Expose SSH and PROX ports
45 EXPOSE 22 8474
46
47 # Copy SSH keys
48 COPY ./rapid_rsa_key.pub /home/centos/.ssh/authorized_keys
49 COPY ./rapid_rsa_key.pub /root/.ssh/authorized_keys
50
51 RUN chown centos:centos /home/centos/.ssh/authorized_keys \
52  && chmod 600 /home/centos/.ssh/authorized_keys \
53  && chown root:root /root/.ssh/authorized_keys \
54  && chmod 600 /root/.ssh/authorized_keys
55
56 # Copy startup script
57 COPY ./start.sh /start.sh
58 RUN chmod +x /start.sh
59
60 ENTRYPOINT ["/start.sh"]