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