Browse Source

Merge pull request #1764 from 0rax/develop

Volumed data setup changed to allow #1759
pull/1766/head
无闻 9 years ago
parent
commit
575300cd57
  1. 6
      docker/s6/gogs/setup
  2. 20
      docker/s6/openssh/setup
  3. 7
      docker/start.sh

6
docker/s6/gogs/setup

@ -1,11 +1,7 @@
#!/bin/sh
if ! test -d /data/gogs; then
mkdir -p /data/gogs/data /data/gogs/conf /data/gogs/log /data/git
fi
if ! test -d ~git/.ssh; then
mkdir ~git/.ssh
mkdir -p ~git/.ssh
chmod 700 ~git/.ssh
fi

20
docker/s6/openssh/setup

@ -1,12 +1,26 @@
#!/bin/sh
if ! test -d /data/ssh; then
mkdir -p /data/ssh
# Check if host keys are present, else create them
if ! test -d /data/ssh/ssh_host_key; then
ssh-keygen -q -f /data/ssh/ssh_host_key -N '' -t rsa1
fi
if ! test -d /data/ssh/ssh_host_rsa_key; then
ssh-keygen -q -f /data/ssh/ssh_host_rsa_key -N '' -t rsa
fi
if ! test -d /data/ssh/ssh_host_dsa_key; then
ssh-keygen -q -f /data/ssh/ssh_host_dsa_key -N '' -t dsa
fi
if ! test -d /data/ssh/ssh_host_ecdsa_key; then
ssh-keygen -q -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
fi
if ! test -d /data/ssh/ssh_host_ed25519_key; then
ssh-keygen -q -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519
fi
# Set correct right to ssh keys
chown -R root:root /data/ssh/*
chmod 600 /data/ssh/*
fi

7
docker/start.sh

@ -5,6 +5,13 @@
rm -rf $(find /app/gogs/docker/s6/ -name 'event')
rm -rf /app/gogs/docker/s6/SOCAT_*
# Create VOLUME subfolder
for f in /data/gogs/data /data/gogs/conf /data/gogs/log /data/git /data/ssh; do
if ! test -d $f; then
mkdir -p $f
fi
done
# Bind linked docker container to localhost socket using socat
env | sed -En 's|(.*)_PORT_([0-9]*)_TCP=tcp://(.*):(.*)|\1_\2 socat -ls TCP4-LISTEN:\2,fork,reuseaddr TCP4:\3:\4|p' | \
while read NAME CMD; do

Loading…
Cancel
Save