Răsfoiți Sursa

HUE-9018 [docker] Containerize documentation website

Romain 6 ani în urmă
părinte
comite
ac5d6d2400

+ 1 - 5
tools/docker/hue/Dockerfile

@@ -2,7 +2,7 @@
 # Build an image from a remote github or local cloned Hue repository.
 
 FROM ubuntu:18.04
-LABEL description="Hue Project https://github.com/cloudera/hue"
+LABEL description="Hue SQL Assistant - gethue.com"
 
 RUN apt-get update -y && apt-get install -y \
   build-essential \
@@ -33,7 +33,6 @@ RUN apt-get update -y && apt-get install -y \
   # openssl \ # Breaks build
   xmlsec1 \
   libxmlsec1-openssl \
-  hugo \
   && rm -rf /var/lib/apt/lists/*
 
 ADD . /hue
@@ -50,9 +49,6 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - \
 RUN PREFIX=/usr/share make install
 RUN useradd -ms /bin/bash hue && chown -R hue /usr/share/hue
 
-# Build the docs (not in Makefile yet)
-# RUN hugo --source docs/docs-site
-
 # Only keep install dir
 WORKDIR /usr/share/hue
 RUN rm -rf /hue

+ 1 - 1
tools/docker/nginx/Dockerfile

@@ -1,7 +1,7 @@
 # Welcome to Hue NGINX (http://gethue.com) Dockerfile
 
 FROM nginx
-LABEL description="Image for Webserver"
+LABEL description="Host files of Hue"
 
 COPY --from=gethue/hue:latest /usr/share/hue/build/static/ /usr/share/nginx/html/hue/static
 

+ 29 - 0
tools/docker/website/Dockerfile

@@ -0,0 +1,29 @@
+
+FROM nginx
+LABEL description="Hue websites, e.g. docs, gethue..."
+
+RUN apt-get update -y && apt-get install -y \
+  wget \
+  python-pip
+
+RUN wget https://github.com/gohugoio/hugo/releases/download/v0.58.3/hugo_0.58.3_Linux-64bit.deb
+RUN dpkg -i hugo*.deb && rm hugo*.deb
+RUN pip install Pygments
+
+COPY tools/docker/nginx/nginx.conf /etc/nginx/nginx.conf
+COPY tools/docker/website/docs.gethue.com.conf /etc/nginx/sites-available/docs.gethue.com
+
+RUN mkdir /etc/nginx/sites-enabled
+
+# Docs
+ADD docs/docs-site /docs
+WORKDIR /docs
+RUN hugo
+
+RUN mkdir -p /var/www/docs.gethue.com/html
+RUN cp -R public/* /var/www/docs.gethue.com/html
+RUN chmod -R 755 /var/www/docs.gethue.com
+RUN ln -s /etc/nginx/sites-available/docs.gethue.com /etc/nginx/sites-enabled/docs.gethue.com
+RUN rm -rf /docs
+
+EXPOSE 80

+ 12 - 0
tools/docker/website/README.md

@@ -0,0 +1,12 @@
+
+## Build
+
+    docker build . -t gethue/website:latest -f tools/docker/website/Dockerfile
+
+## Push
+
+    docker push gethue/website:latest
+
+## Run
+
+    docker run -it -p 80:80 gethue/website:latest

+ 14 - 0
tools/docker/website/docs.gethue.com.conf

@@ -0,0 +1,14 @@
+
+server {
+        server_name docs.gethue.com;
+
+        listen 80 default_server;
+        listen [::]:80 default_server;
+
+        root /var/www/docs.gethue.com/html;
+        index index.html;
+
+        location / {
+                try_files $uri $uri/ =404;
+        }
+}

+ 95 - 0
tools/docker/website/nginx.conf

@@ -0,0 +1,95 @@
+user www-data;
+worker_processes 4;
+pid /run/nginx.pid;
+
+events {
+	worker_connections 768;
+	# multi_accept on;
+}
+
+http {
+
+	##
+	# Basic Settings
+	##
+
+	sendfile on;
+	tcp_nopush on;
+	tcp_nodelay on;
+	keepalive_timeout 65;
+	types_hash_max_size 2048;
+	# server_tokens off;
+
+	server_names_hash_bucket_size 64;
+	# server_name_in_redirect off;
+
+	include /etc/nginx/mime.types;
+	default_type application/octet-stream;
+
+	##
+	# Logging Settings
+	##
+
+	access_log /var/log/nginx/access.log;
+	error_log /var/log/nginx/error.log;
+
+	##
+	# Gzip Settings
+	##
+
+	gzip on;
+	gzip_disable "msie6";
+
+	# gzip_vary on;
+	# gzip_proxied any;
+	# gzip_comp_level 6;
+	# gzip_buffers 16 8k;
+	# gzip_http_version 1.1;
+	# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+
+	##
+	# nginx-naxsi config
+	##
+	# Uncomment it if you installed nginx-naxsi
+	##
+
+	#include /etc/nginx/naxsi_core.rules;
+
+	##
+	# nginx-passenger config
+	##
+	# Uncomment it if you installed nginx-passenger
+	##
+
+	#passenger_root /usr;
+	#passenger_ruby /usr/bin/ruby;
+
+	##
+	# Virtual Host Configs
+	##
+
+	include /etc/nginx/conf.d/*.conf;
+	include /etc/nginx/sites-enabled/*;
+}
+
+
+#mail {
+#	# See sample authentication script at:
+#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
+#
+#	# auth_http localhost/auth.php;
+#	# pop3_capabilities "TOP" "USER";
+#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
+#
+#	server {
+#		listen     localhost:110;
+#		protocol   pop3;
+#		proxy      on;
+#	}
+#
+#	server {
+#		listen     localhost:143;
+#		protocol   imap;
+#		proxy      on;
+#	}
+#}