autoland: use the neutrino dev server to serve static files (bug 1335535) r?imadueme,glob draft
authorMāris Fogels <mars@mozilla.com>
Tue, 31 Jan 2017 10:30:33 -0500
changeset 74 f5ef3553144ca597b88bb275924618032a1449b9
parent 61 354bab149f68e56dfac5f41293fba7630420dd99
child 75 eb4f7ff16c5aa6d94735685e40c72aff141d0620
push id47
push usermfogels@mozilla.com
push dateWed, 01 Feb 2017 21:20:20 +0000
reviewersimadueme, glob
bugs1335535
autoland: use the neutrino dev server to serve static files (bug 1335535) r?imadueme,glob Serve all html files from the neutrino nodejs development server, proxied through nginx. Remove the old static html/js compilation code and the associated docker-compose container: developers might need to clean up the orphaned images. MozReview-Commit-ID: 6HvFmD9HMzJ
autoland/docker-compose.yml
autoland/docker/web/nginx-conf.d/default.conf
autoland/ui/Dockerfile-dev
autoland/ui/docker/Dockerfile-dev
autoland/ui/docker/build.sh
--- a/autoland/docker-compose.yml
+++ b/autoland/docker-compose.yml
@@ -4,25 +4,25 @@
 
 version: '2'
 services:
   web:
     image: nginx:alpine
     ports:
       - "8888:80"
     volumes:
-      - ./ui/build:/usr/share/nginx/html:ro
       - ./docker/web/nginx-conf.d:/etc/nginx/conf.d:ro
 
-  uibuilder:
+  yarn:
     build:
       context: ./ui
-      dockerfile: ./docker/Dockerfile-dev
+      dockerfile: ./Dockerfile-dev
+    command: start
     volumes:
-      - ./ui/build:/code/build
+      - ./ui/src:/code/src
 
   autolandweb:
     build:
       context: ./public-web-api
       dockerfile: ./Dockerfile-dev
     ports:
      - "9999:9090"
     volumes:
--- a/autoland/docker/web/nginx-conf.d/default.conf
+++ b/autoland/docker/web/nginx-conf.d/default.conf
@@ -1,22 +1,14 @@
 server {
     listen       80;
     server_name  localhost;
 
     location / {
-        root   /usr/share/nginx/html;
-        index  index.html index.htm;
-    }
-
-    # redirect server error pages to the static page /50x.html
-    #
-    error_page   500 502 503 504  /50x.html;
-    location = /50x.html {
-        root   /usr/share/nginx/html;
+        proxy_pass  http://yarn:4000/;
     }
 
     # Proxy requests to the autoland backing service
     location ~ /api/.* {
         proxy_pass  http://autolandweb:9090;
     }
 }
 
rename from autoland/ui/docker/Dockerfile-dev
rename to autoland/ui/Dockerfile-dev
--- a/autoland/ui/docker/Dockerfile-dev
+++ b/autoland/ui/Dockerfile-dev
@@ -1,26 +1,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 FROM node:7-alpine
 
-ENV SRC /code
-
 RUN npm install -g yarn@0.19.1
 
-RUN mkdir -p /code/build /code/src
-ADD package.json yarn.lock /code/
+RUN mkdir -p /code/src
 
 WORKDIR /code
 
+COPY package.json /code
+COPY yarn.lock /code
 RUN yarn --pure-lockfile
 
-ADD docker/build.sh /code/
-RUN chmod +x /code/build.sh
-
-ADD src/ /code/src/
-
 # Update $PATH so yarn can find scripts installed by dependencies
 ENV PATH /code/node_modules/.bin:$PATH
 
-CMD ["/code/build.sh"]
\ No newline at end of file
+EXPOSE 4000
+
+ENTRYPOINT ["yarn"]
+CMD ["--help"]
\ No newline at end of file
deleted file mode 100644
--- a/autoland/ui/docker/build.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# Build the project's static UI assets.
-#
-# Run this script from the root of the ui sources (where package.json is).
-
-# 1. Yarn deletes the /build directory contents and compiles React.
-yarn build
-
-# 2. We need to include the fixtures/ subdirectory in the bundle of static
-# assets, which 'yarn build' doesn't include.
-cp -r src/fixtures build/
\ No newline at end of file