Browse Source

Fix monasca-grafana being unbuildable due to old npm

Affected builds on Ubuntu which had:
npm 3.5.2
while the latest was:
npm 6.13.4
And CentOS had:
npm 5.6.0

This patch runs npm update via npm.
Pinned to 6.x.

Additionally, this moves npm packages prefix (root) to
/usr/local to avoid conflicts with native packages.

Change-Id: Ibaacc1cc478b2b2f8196a5da4eea3570d7d310ff
Closes-bug: #1856699
(cherry picked from commit 308e85aa41)
tags/8.0.2
Radosław Piliszek 2 months ago
parent
commit
acbc6e0eb9
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      docker/monasca/monasca-grafana/Dockerfile.j2

+ 6
- 1
docker/monasca/monasca-grafana/Dockerfile.j2 View File

@@ -50,6 +50,9 @@ ARG monasca_grafana_url=https://github.com/monasca/grafana/archive/$monasca_graf
{% block monasca_grafana_install %}
# NOTE(mgoddard): Pinning rake because rake 13.0.0 depends on Ruby 2.2, and CentOS 7 only provides
# Ruby 2.0.
# NOTE(yoctozepto): Update npm to 6.x version to avoid issues with metadata parsing.
# NPM installs itself in /usr/local/bin (the default in Ubuntu) which is not in the PATH.
# This is forced for all distros to avoid conflicts with native packages.
RUN gem install rake:"~>12" fpm \
&& curl -sSL -o /tmp/monasca-grafana.tgz ${monasca_grafana_url} \
&& mkdir -p ${monasca_grafana_build_path} \
@@ -57,7 +60,9 @@ RUN gem install rake:"~>12" fpm \
&& rm -f /tmp/monasca-grafana.tgz \
&& cd ${monasca_grafana_build_path} \
&& go run build.go setup \
&& npm install \
&& npm config set prefix /usr/local -g \
&& npm install npm@6.x -g \
&& /usr/local/bin/npm install \
&& go run build.go build package \
&& mv ${monasca_grafana_build_path}/dist /grafana_pkgs \
&& rm -rf /grafana

Loading…
Cancel
Save