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 <dengq@vmware.com>
This commit is contained in:
Qian Deng 2019-08-01 03:37:18 +00:00
parent 303471563f
commit 89d6370201
3 changed files with 12 additions and 28 deletions

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,4 @@
user nginx nginx;
worker_processes auto;
pid /tmp/nginx.pid;