start.sh 473 B

123456789101112
  1. #!/bin/sh
  2. # Bind linked docker container to localhost socket using socat
  3. env | sed -En 's|(.*)_PORT_([0-9]*)_TCP=tcp://(.*):(.*)|\1_\2 socat -ls TCP4-LISTEN:\2,fork,reuseaddr TCP4:\3:\4|p' | \
  4. while read NAME CMD; do
  5. mkdir -p /app/gogs/docker/s6/$NAME
  6. echo -e "#!/bin/sh\nexec $CMD" > /app/gogs/docker/s6/$NAME/run
  7. chmod +x /app/gogs/docker/s6/$NAME/run
  8. done
  9. # Exec S6 as process manager for gogs and dropbear ssh
  10. exec /usr/bin/s6-svscan /app/gogs/docker/s6/