Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(frontend) introduce frontend Docker image

antoine lebaudf051938ace0d
diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile
new file mode 100644
index 00000000..4036763d
--- /dev/null
+++ b/src/frontend/Dockerfile
@@ -0,0 +1,50 @@
+FROM node:20-alpine as frontend-deps
+
+WORKDIR /home/frontend/
+
+COPY ./src/frontend/package.json ./package.json
+COPY ./src/frontend/package-lock.json ./package-lock.json
+
+RUN npm ci
+
+COPY .dockerignore ./.dockerignore
+COPY ./src/frontend/ .
+
+### ---- Front-end builder image ----
+FROM frontend-deps as meet
+
+WORKDIR /home/frontend
+
+FROM frontend-deps as meet-dev
+
+WORKDIR /home/frontend
+
+EXPOSE 3000
+
+CMD [ "npm", "run", "dev"]
+
+# Tilt will rebuild Meet target so, we dissociate meet and meet-builder
+# to avoid rebuilding the app at every changes.
+FROM meet as meet-builder
+
+WORKDIR /home/frontend
+
+RUN npm run build
+
+# ---- Front-end image ----
+FROM nginxinc/nginx-unprivileged:1.25 as frontend-production
+
+# Un-privileged user running the application
+ARG DOCKER_USER
+USER ${DOCKER_USER}
+
+COPY --from=meet-builder \
+ /home/frontend/dist \
+ /usr/share/nginx/html
+
+COPY ./src/frontend/default.conf /etc/nginx/conf.d
+COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint
+
+ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/src/frontend/default.conf b/src/frontend/default.conf
new file mode 100644
index 00000000..fe8f1cb9
--- /dev/null
+++ b/src/frontend/default.conf
@@ -0,0 +1,15 @@
+server {
+ listen 8080;
+ server_name localhost;
+
+ root /usr/share/nginx/html;
+
+ location / {
+ try_files $uri index.html $uri/ =404;
+ }
+
+ error_page 404 /404.html;
+ location = /404.html {
+ internal;
+ }
+}