summaryrefslogtreecommitdiff
path: root/frontend/Dockerfile
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-07-15 15:45:02 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:05 +0200
commita196ba2c08bd16479134ab542f2560b75f19424f (patch)
treec44ad8d0c89c8997068e7c792265bd1db43c347c /frontend/Dockerfile
parent02997b2522b9c66072b16f1425c02e81e0085e3c (diff)
Make frontend independent of API
This change makes the frontend independent of the API by removing the static file serving logic from the API server. Instead, we can serve the frontend as static HTML over CDNs.
Diffstat (limited to 'frontend/Dockerfile')
-rw-r--r--frontend/Dockerfile19
1 files changed, 19 insertions, 0 deletions
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
new file mode 100644
index 00000000..36e3c20b
--- /dev/null
+++ b/frontend/Dockerfile
@@ -0,0 +1,19 @@
+FROM node:14
+MAINTAINER OpenDC Maintainers <opendc@atlarge-research.com>
+
+ARG REACT_APP_OAUTH_CLIENT_ID
+
+# Copy OpenDC directory
+COPY ./ /opendc
+
+# Build frontend
+RUN cd /opendc/ \
+ && rm -rf ./build \
+ && yarn \
+ && export REACT_APP_OAUTH_CLIENT_ID=$REACT_APP_OAUTH_CLIENT_ID \
+ && yarn build
+
+# Setup nginx to serve the frontend
+FROM nginx:1.19
+COPY --from=0 /opendc/build /usr/share/nginx/html
+COPY nginx.conf /etc/nginx/conf.d/default.conf