Skip to content

Commit

Permalink
fix(compose-ng): add support for setting container devices
Browse files Browse the repository at this point in the history
  • Loading branch information
japtain-cack committed Dec 18, 2020
1 parent ab48dcd commit 2b04ee7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docker/compose/ng.sls
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ include:
- restart_policy: {{ policy[0] }}:{{ policy[-1] }}
{%- endif %}
{%- endif %}
{%- if 'devices' in container %}
- devices:
{%- for device in container.devices %}
{%- set mapping = device.rsplit(':', 1) %}
{%- if mapping|length > 1 %}
- "{{ mapping[0] }}:{{ mapping[-1] }}"
{%- else %}
- "{{ mapping[0] }}"
{%- endif %}
{%- endfor %}
{%- endif %}
- require:
- docker_image: {{ formula }}-compose-ng-{{ id }}-present
{%- if required_containers is defined %}
Expand Down
17 changes: 17 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ docker:
delay: 5s
max_attempts: 3
window: 120s
mycroft01:
image: "mycroftai/docker-mycroft"
container_name: "mycroft01"
ports:
- "8181:8181/tcp"
- "8181:8181/udp"
environment:
"PULSE_SERVER": "unix:${XDG_RUNTIME_DIR}/pulse/native"
volumes:
- "/opt/mycroft/mycroft01:/root/.mycroft"
- "/run/user/1001/pulse/native:/run/user/1001/pulse/native"
- "/var/run/pulse/.config/pulse/cookie:/root/.config/pulse/cookie"
devices:
- "/dev/snd"
restart: "always"
tty: true
stdin_open: true

swarm:
# Per https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.swarm.html
Expand Down

0 comments on commit 2b04ee7

Please sign in to comment.