From b022bec1fa35f69de0489ed05d08d8c453f58858 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 15 Jan 2021 07:53:44 -0600 Subject: [PATCH] switch to docker based web builds --- Makefile | 2 +- docker/Dockerfile.base | 4 +++- docker/Dockerfile.web | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 docker/Dockerfile.web diff --git a/Makefile b/Makefile index 9bd90f2b5..2eb418217 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ version: echo "VERSION='0.8.0-$(COMMIT_HASH)'" > frigate/version.py web: - cd web && npm install && npm run build + docker build --tag frigate-web --file docker/Dockerfile.web web/ amd64_wheels: docker build --tag blakeblackshear/frigate-wheels:amd64 --file docker/Dockerfile.wheels . diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 024cb9676..9e98bb212 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -2,6 +2,7 @@ ARG ARCH=amd64 ARG FFMPEG_VERSION FROM blakeblackshear/frigate-wheels:${ARCH} as wheels FROM blakeblackshear/frigate-ffmpeg:${FFMPEG_VERSION}-${ARCH} as ffmpeg +FROM frigate-web as web FROM ubuntu:20.04 LABEL maintainer "blakeb@blakeshome.com" @@ -45,7 +46,8 @@ RUN wget -q https://github.com/google-coral/test_data/raw/master/ssdlite_mobiled WORKDIR /opt/frigate/ ADD frigate frigate/ ADD migrations migrations/ -ADD web/build web/ + +COPY --from=web /opt/frigate/build web/ COPY run.sh /run.sh RUN chmod +x /run.sh diff --git a/docker/Dockerfile.web b/docker/Dockerfile.web new file mode 100644 index 000000000..54cdce3fe --- /dev/null +++ b/docker/Dockerfile.web @@ -0,0 +1,9 @@ +ARG NODE_VERSION=14.0 + +FROM node:${NODE_VERSION} + +WORKDIR /opt/frigate + +COPY . . + +RUN npm install && npm run build