Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ning multiple processes in a container
  • Loading branch information
damonmorgan committed Jun 7, 2020
1 parent 3619b30 commit a52e0d7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ RUN shards build
RUN ldd /docker_mdns/bin/docker_mdns | tr -s '[:blank:]' '\n' | grep '^/' | \
xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;'

FROM alpine
FROM lsiobase/alpine

RUN apk add --update --no-cache avahi
RUN apk add --update --no-cache \
avahi \
augeas

COPY --from=builder /docker_mdns/deps /
COPY --from=builder /docker_mdns/bin/docker_mdns /usr/local/bin/docker_mdns
COPY entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh

#ENTRYPOINT ["/opt/entrypoint.sh"]
COPY root/ /
5 changes: 0 additions & 5 deletions entrypoint.sh

This file was deleted.

25 changes: 25 additions & 0 deletions root/etc/cont-init.d/20-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/with-contenv bash

AUG_BASE="/files/etc/avahi/avahi-daemon.conf"

avahi_set() {
if [ $# -lt 3 ]; then
>&2 echo "Usage: avahi_set SECTION KEY VALUE"
return 1
fi
augtool set "${AUG_BASE}/$1/$2" "$3"
}

# Defaults
SERVER_ENABLE_DBUS=${SERVER_ENABLE_DBUS:-no}

# server section
if [ -n "${SERVER_HOST_NAME}" ]; then
avahi_set "server" "host-name" "${SERVER_HOST_NAME}"
fi
if [ -n "${SERVER_DOMAIN_NAME}" ]; then
avahi_set "server" "domain-name" "${SERVER_DOMAIN_NAME}"
fi
if [ -n "${SERVER_ENABLE_DBUS}" ]; then
avahi_set "server" "enable-dbus" "${SERVER_ENABLE_DBUS}"
fi
3 changes: 3 additions & 0 deletions root/etc/services.d/avahi/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash

exec avahi-daemon
3 changes: 3 additions & 0 deletions root/etc/services.d/mdns/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash

exec s6-setuidgid abc /usr/local/bin/docker_mdns "$NETWORK_INTERFACE"

0 comments on commit a52e0d7

Please sign in to comment.