From 3c04deec042ca775fdeb77d7e2ea0802ced033f8 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 4 May 2018 02:35:47 -0400 Subject: [PATCH 1/5] Migrated to alpine linux. (20MB vs 220MB node image) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8ce2bd8..2e942d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:9.8.0 as builder +FROM node:9.8.0-alpine as builder ARG GMAPS_API_KEY WORKDIR oldto-site From 0f4f8abef1e98fc508d4f239786b5602d73c2d45 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 4 May 2018 02:36:35 -0400 Subject: [PATCH 2/5] Proxied docker api endpoint to live Sidewalk Labs API. --- nginx.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx.config b/nginx.config index 84cf5f3..4924950 100644 --- a/nginx.config +++ b/nginx.config @@ -13,6 +13,6 @@ server { # proxy the /api to connect to the API server: location /api { - proxy_pass http://swl-api-server-web:8000; + proxy_pass http://api.sidewalklabs.com; } } From b21cea40d59bd22b95737252c24203210eef7411 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 4 May 2018 02:36:51 -0400 Subject: [PATCH 3/5] Added docker-compose file. --- docker-compose.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a79529e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + webapp: + build: + context: . + dockerfile: Dockerfile + ports: + - "5000:80" From f842a4fd9a2f9e130d7412e341f098d934345938 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 4 May 2018 02:37:00 -0400 Subject: [PATCH 4/5] Added docker instructions. --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12e3679..e212018 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,27 @@ for popular locations like the CN Tower or City Hall. * Live site: https://oldtoronto.sidewalklabs.com -## Development setup +## :computer: Local Development + +If you're willing to install docker, it is usually the simplest way to +get up and running. + +### Docker + +**Docker** is a tool that helps isolate your development environment. + +**Requirements:** +- Docker (tested on v17.10.0) +- Docker Compose (tested in v1.16.1) + +``` +$ cd path/to/oldto +$ docker-compose up +``` + +You may now view the webapp at: [`localhost:5000`][http://localhost:5000] + +### Manually Setup dependencies (on a Mac): From 2b253a49c3d6d869405be4c0fcc28aa7a974b1b5 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Fri, 4 May 2018 02:46:44 -0400 Subject: [PATCH 5/5] Oops. Migrate nginx image to alpine too. (20MB) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2e942d4..b2e45fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY oldto-site . ENV GMAPS_API_KEY $GMAPS_API_KEY RUN yarn && yarn webpack -FROM nginx +FROM nginx:1.13.12-alpine COPY --from=builder oldto-site/dist /usr/share/nginx/html COPY nginx.config /etc/nginx/conf.d/default.conf