Переглянути джерело

HUE-8730 [docker] Workaround the webpack generation

Romain Rigaux 6 роки тому
батько
коміт
ce523a6
3 змінених файлів з 44 додано та 21 видалено
  1. 25 0
      desktop/libs/librdbms/Makefile
  2. 18 20
      tools/docker/hue/Dockerfile
  3. 1 1
      tools/docker/hue/README.md

+ 25 - 0
desktop/libs/librdbms/Makefile

@@ -36,4 +36,29 @@ env-install: compile ext-env-install
 	@$(ENV_PYTHON) setup.py develop -N -q
 
 
+###################################
+# Build DBProxy plugin
+###################################
 
+PLUGIN_DIR := $(realpath .)
+PLUGIN_JAVA_LIB := $(PLUGIN_DIR)/java-lib
+PLUGIN_JAVA_DIR := $(PLUGIN_DIR)/java
+BLD_DIR_PLUGINS := $(PLUGIN_DIR)/java/target
+
+compile: $(DB_PROXY_JAR)
+
+# Build the plugin jar iff the source is present
+ifneq (,$(wildcard $(PLUGIN_JAVA_DIR)))
+$(DB_PROXY_JAR): $(shell find $(PLUGIN_JAVA_DIR) -type f)
+	mkdir -p $(PLUGIN_JAVA_LIB)
+	@echo "--- Building DBProxy plugin"
+	cd $(PLUGIN_JAVA_DIR) && mvn clean install -DskipTests $(MAVEN_OPTIONS)
+	cp $(BLD_DIR_PLUGINS)/dbproxy-1.0-SNAPSHOT.jar $(DB_PROXY_JAR)
+
+clean::
+	rm -rf $(PLUGIN_JAVA_LIB)
+	cd $(PLUGIN_JAVA_DIR) && mvn clean $(MAVEN_OPTIONS) ||:
+else
+$(DB_PROXY_JAR):
+	$(error Cannot build DBProxy plugin without source)
+endif

+ 18 - 20
tools/docker/hue/Dockerfile

@@ -29,38 +29,36 @@ RUN apt-get update -y && apt-get install -y \
   maven \
    && rm -rf /var/lib/apt/lists/*
 
-#RUN add-apt-repository -y ppa:webupd8team/java
-#RUN apt-get update -y
-#RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
-#RUN apt-get install -y oracle-java8-installer
+RUN add-apt-repository -y ppa:webupd8team/java
+RUN apt-get update -y
+RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
+RUN apt-get install -y oracle-java8-installer
 
 ADD . /hue
+WORKDIR /hue
 
-RUN cd /hue && PREFIX=/usr/share make install
-RUN useradd -ms /bin/bash hue && chown -R hue /usr/share/hue
-RUN chmod 777 /usr/share/hue/desktop/desktop.db
+# Not doing a `make prod` equivalent, so manually getting production ini
+RUN rm desktop/conf/*
+COPY desktop/conf.dist desktop/conf
 
-# Not doing a `make prod` above yet, so manually get prod ini
-RUN rm /usr/share/hue/desktop/conf/*
-COPY desktop/conf.dist /usr/share/hue/desktop/conf
+# Need recent version for Ubuntu
+RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
+RUN apt-get install -y nodejs
 
-COPY tools/docker/hue/conf /usr/share/hue/desktop/conf
-COPY tools/docker/hue/startup.sh /usr/share/hue
+RUN PREFIX=/usr/share make install
+RUN useradd -ms /bin/bash hue && chown -R hue /usr/share/hue
 
 WORKDIR  /usr/share/hue
 RUN ./build/env/bin/pip install psycopg2-binary
 
-# Webpack not integrated into make install yet
-COPY package.json /usr/share/hue
-COPY webpack.config.js /usr/share/hue
-
-# Need recent version for Ubuntu
-RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
-RUN apt-get install -y nodejs
+COPY tools/docker/hue/conf desktop/conf
+COPY tools/docker/hue/startup.sh .
 
+# Webpack not integrated into make install
+COPY package.json .
+COPY webpack.config.js .
 RUN npm install
 RUN npm run webpack
-
 RUN ./build/env/bin/hue collectstatic --noinput
 
 EXPOSE 8888

+ 1 - 1
tools/docker/hue/README.md

@@ -3,7 +3,7 @@
 
 ## Get the docker image
 
-Just pull the latest from the Internet or build it yourself from the Hue repository.
+Just pull the latest from the Internet or build it yourself from the Hue repository via the [Dockerfile](Dockerfile).
 
 
 ### Pull the image from Docker Hub