autoland: stand up an autoland environment with docker-compose (
bug 1330812) r?smacleod
Use docker-compose to stand up an nginx web proxy, react-based static site, and
the autoland API service. Also removed the docker-compose.yml file in
public-web-api/ in preference to the docker-compose.yml file in the project
root.
MozReview-Commit-ID: 2zlKz8vSM3v
new file mode 100644
--- /dev/null
+++ b/autoland/docker-compose.yml
@@ -0,0 +1,32 @@
+# 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/.
+
+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:
+ build:
+ context: ./ui
+ dockerfile: ./docker/Dockerfile-dev
+ volumes:
+ - ./ui/build:/code/build
+
+ autolandweb:
+ build:
+ context: ./public-web-api
+ dockerfile: ./Dockerfile-dev
+ ports:
+ - "9999:9090"
+ volumes:
+ - ./public-web-api:/app
+ environment:
+ - AUTOLANDWEB_DEBUG=1
+ - AUTOLANDWEB_PORT=9090
new file mode 100644
--- /dev/null
+++ b/autoland/docker/web/nginx-conf.d/default.conf
@@ -0,0 +1,22 @@
+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 requests to the autoland backing service
+ location /api {
+ proxy_pass http://autolandweb:9090/;
+ }
+}
+
deleted file mode 100644
--- a/autoland/public-web-api/docker-compose.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-version: '2'
-services:
- autolandweb:
- build:
- context: .
- dockerfile: Dockerfile-dev
- ports:
- - "9999:9090"
- volumes:
- - .:/app
- environment:
- - AUTOLANDWEB_DEBUG=1
- - AUTOLANDWEB_PORT=9090
new file mode 100644
--- /dev/null
+++ b/autoland/ui/docker/Dockerfile-dev
@@ -0,0 +1,26 @@
+# 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/
+
+WORKDIR /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
new file mode 100644
--- /dev/null
+++ b/autoland/ui/docker/build.sh
@@ -0,0 +1,11 @@
+#!/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