Sirisha_Manchikanti | f83411a | 2021-05-07 15:17:52 +0100 | [diff] [blame^] | 1 | ### |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # ONAP CLAMP |
| 4 | # ================================================================================ |
| 5 | # Copyright (C) 2019 AT&T Intellectual Property. All rights |
| 6 | # reserved. |
| 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 | # ============LICENSE_END============================================ |
| 20 | # =================================================================== |
| 21 | # |
| 22 | ### |
| 23 | |
| 24 | # build environment |
| 25 | FROM node:12.10.0-alpine as build |
| 26 | WORKDIR /app |
| 27 | #ENV PATH /app/node_modules/.bin:$PATH |
| 28 | COPY onap-policy-clamp-frontend/ /app/ |
| 29 | RUN npm install --silent && \ |
| 30 | npm run build |
| 31 | |
| 32 | FROM nginx:1.17.0-alpine |
| 33 | |
| 34 | MAINTAINER "The Onap Team" |
| 35 | LABEL Description="This image contains Clamp frontend" |
| 36 | |
| 37 | ARG http_proxy |
| 38 | ARG https_proxy |
| 39 | ENV HTTP_PROXY=$http_proxy |
| 40 | ENV HTTPS_PROXY=$https_proxy |
| 41 | ENV http_proxy=$HTTP_PROXY |
| 42 | ENV https_proxy=$HTTPS_PROXY |
| 43 | |
| 44 | RUN addgroup onap && \ |
| 45 | adduser -D -G onap clamp && \ |
| 46 | mkdir /var/log/onap && \ |
| 47 | chmod a+rwx /var/log/onap |
| 48 | |
| 49 | COPY --from=build /app/build /usr/share/nginx/html |
| 50 | COPY --from=build /app/ssl /etc/ssl |
| 51 | |
| 52 | RUN rm /etc/nginx/conf.d/default.conf && \ |
| 53 | ln -sf /dev/stdout /var/log/nginx/access.log && \ |
| 54 | ln -sf /dev/stderr /var/log/nginx/error.log |
| 55 | |
| 56 | COPY nginx/nginx.conf /etc/nginx/nginx.conf |
| 57 | COPY nginx/default.conf /etc/nginx/conf.d/default.conf |
| 58 | |
| 59 | WORKDIR /app |
| 60 | |
| 61 | RUN chown -R clamp:onap /app && chmod -R 755 /app && \ |
| 62 | chown -R clamp:onap /var/cache/nginx && \ |
| 63 | chown -R clamp:onap /var/log/nginx && \ |
| 64 | chown -R clamp:onap /etc/nginx/conf.d && \ |
| 65 | touch /var/run/nginx.pid && \ |
| 66 | chown -R clamp:onap /var/run/nginx.pid |
| 67 | |
| 68 | USER clamp |
| 69 | EXPOSE 2443 |
| 70 | CMD ["nginx", "-g", "daemon off;"] |
| 71 | |