diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile new file mode 100644 index 0000000000..1fb17c7f11 --- /dev/null +++ b/build/docker/Dockerfile @@ -0,0 +1,26 @@ +# Alpine was chosen by providing a node container less than 100mb +FROM node:17.7.1-alpine3.15 + +WORKDIR /usr/src/app + +# install dependencies +RUN apk add --update --no-cache openssh git python3 openjdk11-jre-headless +RUN ln -sf python3 /usr/bin/python + +# Change to non-root user +USER node + +# Python user's setup +RUN mkdir -p /home/node/.local/bin +ENV PATH="$PATH:/home/node/.local/bin" +RUN python3 -m ensurepip +RUN pip3 install --no-cache --upgrade pip setuptools + +# Prevent proxy timeout error (very slow connections) +RUN npm config set fetch-retry-mintimeout 20000 +RUN npm config set fetch-retry-maxtimeout 120000 +RUN npm config rm proxy +RUN npm config rm https-proxy + +# Run compilation +CMD [ "python", "build/all.py" ] diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml new file mode 100644 index 0000000000..68984ac8ce --- /dev/null +++ b/build/docker/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' + +services: + shaka-compiler: + build: ./ + container_name: shaka-compiler + volumes: + - ../../:/usr/src/app + +# Others services can be added here diff --git a/docs/tutorials/welcome.md b/docs/tutorials/welcome.md index e19f73d4cb..2261226ac8 100644 --- a/docs/tutorials/welcome.md +++ b/docs/tutorials/welcome.md @@ -35,6 +35,8 @@ To get the sources and compile the library, you will need: * _NOTE: A local web server is required because browsers place restrictions on applications from file:/// URLs._ +If you just want to compile for export to other projects, you might consider compiling through a docker container. (see compile instructions) + To quickly install these prerequisites on Ubuntu or Debian, you can run this script: @@ -62,6 +64,12 @@ cd shaka-player python build/all.py ``` +Alternatively you can use a docker container: +```sh +cd build/docker +docker-compose run --rm shaka-compiler +``` + The output is: * dist/shaka-player.compiled.js (compiled bundle) * dist/shaka-player.compiled.debug.js (debug bundle)