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

Docker Support #132

Merged
merged 14 commits into from
Feb 2, 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
56 changes: 56 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,59 @@ jobs:
with:
token: ${{secrets.GITHUB_TOKEN}}
tag: ${{env.VERSION}}
build_and_publish_docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Get Version
id: version
run: |
VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version))
echo ::set-output name=version::${VERSION}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for base Docker
id: meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push base Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: base

- name: Extract metadata for default_skills Docker
id: meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-default_skills
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push default_skills Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: default_skills
63 changes: 62 additions & 1 deletion .github/workflows/publish_test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ on:
paths-ignore:
- 'version.py'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/neon-skills

jobs:
build_and_publish:
increment_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -30,3 +34,60 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Increment Version
build_and_publish_docker:
runs-on: ubuntu-latest
needs: increment_version
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Get Version
id: version
run: |
VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version))
echo ::set-output name=version::${VERSION}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for base Docker
id: base_meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push base Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.base_meta.outputs.tags }}
labels: ${{ steps.base_meta.outputs.labels }}
target: base

- name: Extract metadata for default_skills Docker
id: default_skills_meta
uses: docker/metadata-action@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-default_skills
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push default_skills Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.default_skills_meta.outputs.tags }}
labels: ${{ steps.default_skills_meta.outputs.labels }}
target: default_skills
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM python:3.8-slim as base

LABEL vendor=neon.ai \
ai.neon.name="neon-skills"

ENV NEON_CONFIG_PATH /config

RUN apt-get update && \
apt-get install -y \
gcc \
g++ \
python3-dev \
swig \
libssl-dev \
libfann-dev \
portaudio19-dev \
libsndfile1 \
libpulse-dev \
ffmpeg \
git # TODO: git required for getting scripts, skill should be refactored to remove this dependency

ADD . /neon_core
WORKDIR /neon_core

COPY docker_overlay/asoundrc /root/.asoundrc

RUN pip install wheel && \
pip install .

CMD ["neon_skills_service"]

FROM base as default_skills

RUN mkdir -p /root/.config/neon
RUN mkdir -p /root/.local/share/neon
COPY docker_overlay/skill_settings /root/.config/neon/skills
COPY docker_overlay/ngi_local_conf.yml /config/
RUN neon-install-default-skills
RUN rm /config/ngi_local_conf.yml
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,19 @@ where Neon may have saved files:

You may now [re-install Neon](#installing-neon)
> *Note:* You may need your [credential files](#optional-service-account-setup) to complete re-installation.

# Running Docker Modules

Skills Service
```shell
docker run -d \
--name=neon_skills \
--network=host \
-v ~/.config/pulse/cookie:/root/.config/pulse/cookie:ro \
-v ${XDG_RUNTIME_DIR}/pulse:${XDG_RUNTIME_DIR}/pulse:ro \
-v ${NEON_CONFIG_DIR}:/config \
--device=/dev/snd:/dev/snd \
-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
neon_skills
```
>*Note:* The above example assumes `NEON_CONFIG_DIR` contains valid configuration
2 changes: 2 additions & 0 deletions docker_overlay/asoundrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pcm.default pulse
ctl.default pulse
5 changes: 5 additions & 0 deletions docker_overlay/mycroft.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"play_wav_cmdline": "play %1",
"play_mp3_cmdline": "play %1",
"play_ogg_cmdline": "play %1"
}
7 changes: 7 additions & 0 deletions docker_overlay/ngi_local_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
skills:
essential_skills: []
default_skills: https://raw.githubusercontent.com/NeonGeckoCom/neon_skills/master/skill_lists/DEFAULT-SKILLS-DOCKER
skill_manager: osm

dirVars:
skillsDir: /root/.local/share/neon/skills
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"weather_skill": "skill-weather.neongeckocom",
"datetime_skill": "skill-date_time.neongeckocom",
"examples_skill": "skill-about.neongeckocom",
"wallpaper": "default.jpg",
"__mycroft_skill_firstrun": false
}
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ovos-core[skills]==0.0.1
mock_msm

# utils
neon-utils~=0.12,>=0.14.3a7
neon-utils~=0.12,>=0.14.3a15
# TODO: Update to stable version
ovos_utils~=0.0.12
ovos-skills-manager~=0.0.8
Expand Down