summaryrefslogtreecommitdiff
path: root/client/Dockerfile
diff options
context:
space:
mode:
authorShyam Sunder <sgsunder1@gmail.com>2018-07-11 23:30:13 -0400
committerrr- <rr-@sakuya.pl>2018-07-25 13:39:57 +0200
commit6a6c4dc822344df01af0b3849083bc3ceda148e9 (patch)
tree3a05c302814485a686e07f5db8cf825e5ab139c7 /client/Dockerfile
parent9730aa5c050352736327a992f9a428b6bc82cd75 (diff)
build: add Docker functionality and documentation
Diffstat (limited to 'client/Dockerfile')
-rw-r--r--client/Dockerfile31
1 files changed, 31 insertions, 0 deletions
diff --git a/client/Dockerfile b/client/Dockerfile
new file mode 100644
index 0000000..49e0ab6
--- /dev/null
+++ b/client/Dockerfile
@@ -0,0 +1,31 @@
+FROM node:9 as builder
+WORKDIR /opt/app
+
+COPY package.json ./
+RUN npm install
+
+COPY . ./
+
+ARG BUILD_INFO="docker-latest"
+ARG CLIENT_BUILD_ARGS=""
+RUN node build.js ${CLIENT_BUILD_ARGS}
+
+RUN find public/ -type f -size +5k -print0 | xargs -0 -- gzip -6 -k
+
+
+FROM nginx:alpine
+WORKDIR /var/www
+
+RUN \
+ # Create init file
+ echo "#!/bin/sh" >> /init && \
+ echo 'sed -i "s|__BACKEND__|${BACKEND_HOST}|" /etc/nginx/nginx.conf' \
+ >> /init && \
+ echo 'exec nginx -g "daemon off;"' >> /init && \
+ chmod a+x /init
+
+CMD ["/init"]
+VOLUME ["/data"]
+
+COPY nginx.conf.docker /etc/nginx/nginx.conf
+COPY --from=builder /opt/app/public/ .