From 89d637020154c5082565de2451cbbe70504bf29d Mon Sep 17 00:00:00 2001 From: Qian Deng Date: Thu, 1 Aug 2019 03:37:18 +0000 Subject: [PATCH] Remove ruby dependency while build portal Python is already intalled in node image. so we can use python to parse yaml file Signed-off-by: Qian Deng --- make/photon/portal/Dockerfile | 18 ++++++++++++------ make/photon/portal/entrypoint.sh | 21 --------------------- make/photon/portal/nginx.conf | 1 - 3 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 make/photon/portal/entrypoint.sh diff --git a/make/photon/portal/Dockerfile b/make/photon/portal/Dockerfile index 7b7227338..86da53cc1 100644 --- a/make/photon/portal/Dockerfile +++ b/make/photon/portal/Dockerfile @@ -2,15 +2,21 @@ FROM node:10.15.0 as nodeportal RUN mkdir -p /portal_src && mkdir -p /build_dir -COPY make/photon/portal/entrypoint.sh / COPY src/portal /portal_src -COPY ./docs/swagger.yaml /portal_src +COPY ./docs/swagger.yaml /portal_src -WORKDIR /portal_src +WORKDIR /build_dir -RUN npm install && \ - chmod u+x /entrypoint.sh -RUN /entrypoint.sh +RUN cp -r /portal_src/* /build_dir \ + && ls -la \ + && apt-get update \ + && apt-get install python-yaml \ + && cat swagger.yaml | python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' > swagger.json \ + && cat ./package.json \ + && npm install \ + && npm run build_lib \ + && npm run link_lib \ + && npm run release FROM photon:2.0 diff --git a/make/photon/portal/entrypoint.sh b/make/photon/portal/entrypoint.sh deleted file mode 100644 index c00b5e0dc..000000000 --- a/make/photon/portal/entrypoint.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e - -cd /build_dir -cp -r /portal_src/* . -ls -la - -# Update -apt-get update -apt-get install -y ruby -ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' swagger.yaml>swagger.json - -cat ./package.json -npm install - -## Build harbor-portal and link it -npm run build_lib -npm run link_lib - -## Build production -npm run release diff --git a/make/photon/portal/nginx.conf b/make/photon/portal/nginx.conf index 9a643e340..96da5243f 100644 --- a/make/photon/portal/nginx.conf +++ b/make/photon/portal/nginx.conf @@ -1,5 +1,4 @@ -user nginx nginx; worker_processes auto; pid /tmp/nginx.pid;