Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add Dockerfile and docker build instructions #3547

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
10 changes: 10 additions & 0 deletions build/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
shaka-compiler:
build: ./
container_name: shaka-compiler
volumes:
- ../../:/usr/src/app

# Others services can be added here
8 changes: 8 additions & 0 deletions docs/tutorials/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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)
Expand Down