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

Add docker support #140

Open
wants to merge 3 commits into
base: r0.9
Choose a base branch
from
Open
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 web_microphone_websocket/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

*.pbmm
*.scorer

# dependencies
node_modules
.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
24 changes: 23 additions & 1 deletion web_microphone_websocket/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,35 @@
This is an example of a ReactJS web application streaming microphone audio from the browser
to a NodeJS server and transmitting the DeepSpeech results back to the browser.

#### Download the pre-trained model (1.8GB):
## Download the pre-trained model (1.8GB):

```
wget https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/deepspeech-0.9.3-models.pbmm
wget https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/deepspeech-0.9.3-models.scorer
```

## Run example

## Option 1: Run with docker

Edit `docker-compose.yml`, adjust model path with your local model.

```yaml
volumes:
- /path/to/deepspeech-0.9.3-models.pbmm:/deepspeech/deepspeech-0.9.3-models.pbmm:ro
- /path/to/deepspeech-0.9.3-models.scorer:/deepspeech/deepspeech-0.9.3-models.scorer:ro
```

Run

```
docker-compose up -d
```

When container is ready, visit http://localhost:3000 and have fun.

## Option 2: Run locally

#### Install:

```
Expand Down
15 changes: 15 additions & 0 deletions web_microphone_websocket/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'

services:
deepspeech:
build: .
restart: unless-stopped
environment:
- CI=true
volumes:
- /path/to/deepspeech-0.9.3-models.pbmm:/deepspeech/deepspeech-0.9.3-models.pbmm:ro
- /path/to/deepspeech-0.9.3-models.scorer:/deepspeech/deepspeech-0.9.3-models.scorer:ro
ports:
- 3000:3000
- 4000:4000

13 changes: 13 additions & 0 deletions web_microphone_websocket/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:14-buster

EXPOSE 3000 4000

WORKDIR /deepspeech

COPY package.json .

RUN yarn

ADD . .

ENTRYPOINT [ "/deepspeech/entrypoint.sh" ]
4 changes: 4 additions & 0 deletions web_microphone_websocket/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

yarn start &
node server.js
2 changes: 1 addition & 1 deletion web_microphone_websocket/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ io.on('connection', function(socket) {
});
});

app.listen(SERVER_PORT, 'localhost', () => {
app.listen(SERVER_PORT, '0.0.0.0', () => {
console.log('Socket server listening on:', SERVER_PORT);
});

Expand Down