summaryrefslogtreecommitdiffstats
path: root/docker/etc
diff options
context:
space:
mode:
authorThomas Boerger <tboerger@suse.de>2016-11-28 14:13:18 +0100
committerThomas Boerger <tboerger@suse.de>2016-11-28 14:13:18 +0100
commit86aa8e413acc1dbcc7760cb220a6ee2126e926b6 (patch)
tree9ed7aef2aa3c3306fdcb359d557e211c5f65f111 /docker/etc
parentbf8d90c5cc6bea9ec4eeb2e827d10cd247043fe0 (diff)
downloadgitea-86aa8e413acc1dbcc7760cb220a6ee2126e926b6.tar.gz
gitea-86aa8e413acc1dbcc7760cb220a6ee2126e926b6.zip
Restructured docker building
I have restructured the docker build process entirely, the binary gets built outside of the docker build command, now we are managing all dependencies with real Alpine packages and I have dropped features like socat or the cron daemon. Signed-off-by: Thomas Boerger <tboerger@suse.de>
Diffstat (limited to 'docker/etc')
-rw-r--r--docker/etc/nsswitch.conf15
-rwxr-xr-xdocker/etc/profile.d/gitea.sh2
-rwxr-xr-xdocker/etc/s6/.s6-svscan/finish2
-rwxr-xr-xdocker/etc/s6/gitea/finish2
-rwxr-xr-xdocker/etc/s6/gitea/run6
-rwxr-xr-xdocker/etc/s6/gitea/setup19
-rwxr-xr-xdocker/etc/s6/openssh/finish2
-rwxr-xr-xdocker/etc/s6/openssh/run6
-rwxr-xr-xdocker/etc/s6/openssh/setup29
-rwxr-xr-xdocker/etc/s6/syslogd/finish2
-rwxr-xr-xdocker/etc/s6/syslogd/run6
-rwxr-xr-xdocker/etc/s6/syslogd/setup1
-rw-r--r--docker/etc/ssh/sshd_config33
-rw-r--r--docker/etc/templates/app.ini24
14 files changed, 149 insertions, 0 deletions
diff --git a/docker/etc/nsswitch.conf b/docker/etc/nsswitch.conf
new file mode 100644
index 0000000000..25fad995e6
--- /dev/null
+++ b/docker/etc/nsswitch.conf
@@ -0,0 +1,15 @@
+# /etc/nsswitch.conf
+
+passwd: compat
+group: compat
+shadow: compat
+
+hosts: files dns
+networks: files
+
+protocols: db files
+services: db files
+ethers: db files
+rpc: db files
+
+netgroup: nis
diff --git a/docker/etc/profile.d/gitea.sh b/docker/etc/profile.d/gitea.sh
new file mode 100755
index 0000000000..41afd4cfb8
--- /dev/null
+++ b/docker/etc/profile.d/gitea.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+export GITEA_CUSTOM=/data/gitea
diff --git a/docker/etc/s6/.s6-svscan/finish b/docker/etc/s6/.s6-svscan/finish
new file mode 100755
index 0000000000..06bd986563
--- /dev/null
+++ b/docker/etc/s6/.s6-svscan/finish
@@ -0,0 +1,2 @@
+#!/bin/bash
+exit 0
diff --git a/docker/etc/s6/gitea/finish b/docker/etc/s6/gitea/finish
new file mode 100755
index 0000000000..06bd986563
--- /dev/null
+++ b/docker/etc/s6/gitea/finish
@@ -0,0 +1,2 @@
+#!/bin/bash
+exit 0
diff --git a/docker/etc/s6/gitea/run b/docker/etc/s6/gitea/run
new file mode 100755
index 0000000000..246e74d27c
--- /dev/null
+++ b/docker/etc/s6/gitea/run
@@ -0,0 +1,6 @@
+#!/bin/bash
+[[ -f ./setup ]] && source ./setup
+
+pushd /app/gitea > /dev/null
+ exec gosu git /app/gitea/gitea web
+popd
diff --git a/docker/etc/s6/gitea/setup b/docker/etc/s6/gitea/setup
new file mode 100755
index 0000000000..27ca49db30
--- /dev/null
+++ b/docker/etc/s6/gitea/setup
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ ! -d /data/git/.ssh ]; then
+ mkdir -p /data/git/.ssh
+ chmod 700 /data/git/.ssh
+fi
+
+if [ ! -f /data/git/.ssh/environment ]; then
+ echo "GITEA_CUSTOM=/data/gitea" >| /data/git/.ssh/environment
+ chmod 600 /data/git/.ssh/environment
+fi
+
+if [ ! -f /data/gitea/conf/app.ini ]; then
+ mkdir -p /data/gitea/conf
+ cp /etc/templates/app.ini /data/gitea/conf/app.ini
+fi
+
+chown -R git:git /data/gitea /app/gitea /data/git
+chmod 0755 /data/gitea /app/gitea /data/git
diff --git a/docker/etc/s6/openssh/finish b/docker/etc/s6/openssh/finish
new file mode 100755
index 0000000000..06bd986563
--- /dev/null
+++ b/docker/etc/s6/openssh/finish
@@ -0,0 +1,2 @@
+#!/bin/bash
+exit 0
diff --git a/docker/etc/s6/openssh/run b/docker/etc/s6/openssh/run
new file mode 100755
index 0000000000..b4c4cb4088
--- /dev/null
+++ b/docker/etc/s6/openssh/run
@@ -0,0 +1,6 @@
+#!/bin/bash
+[[ -f ./setup ]] && source ./setup
+
+pushd /root > /dev/null
+ exec gosu root /usr/sbin/sshd -E /var/log/sshd.log -D
+popd
diff --git a/docker/etc/s6/openssh/setup b/docker/etc/s6/openssh/setup
new file mode 100755
index 0000000000..b529431a15
--- /dev/null
+++ b/docker/etc/s6/openssh/setup
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+if [ ! -d /data/ssh ]; then
+ mkdir -p /data/ssh
+fi
+
+if [ ! -f /data/ssh/ssh_host_ed25519_key ]; then
+ echo "Generating /data/ssh/ssh_host_ed25519_key..."
+ ssh-keygen -t ed25519 -b 4096 -f /data/ssh/ssh_host_ed25519_key -N "" > /dev/null
+fi
+
+if [ ! -f /data/ssh/ssh_host_rsa_key ]; then
+ echo "Generating /data/ssh/ssh_host_rsa_key..."
+ ssh-keygen -t rsa -b 2048 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null
+fi
+
+if [ ! -f /data/ssh/ssh_host_dsa_key ]; then
+ echo "Generating /data/ssh/ssh_host_dsa_key..."
+ ssh-keygen -t dsa -f /data/ssh/ssh_host_dsa_key -N "" > /dev/null
+fi
+
+if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then
+ echo "Generating /data/ssh/ssh_host_ecdsa_key..."
+ ssh-keygen -t ecdsa -b 256 -f /data/ssh/ssh_host_ecdsa_key -N "" > /dev/null
+fi
+
+chown root:root /data/ssh/*
+chmod 0700 /data/ssh
+chmod 0600 /data/ssh/*
diff --git a/docker/etc/s6/syslogd/finish b/docker/etc/s6/syslogd/finish
new file mode 100755
index 0000000000..06bd986563
--- /dev/null
+++ b/docker/etc/s6/syslogd/finish
@@ -0,0 +1,2 @@
+#!/bin/bash
+exit 0
diff --git a/docker/etc/s6/syslogd/run b/docker/etc/s6/syslogd/run
new file mode 100755
index 0000000000..d876093047
--- /dev/null
+++ b/docker/etc/s6/syslogd/run
@@ -0,0 +1,6 @@
+#!/bin/bash
+[[ -f ./setup ]] && source ./setup
+
+pushd /root > /dev/null
+ exec gosu root /sbin/syslogd -nS -O-
+popd
diff --git a/docker/etc/s6/syslogd/setup b/docker/etc/s6/syslogd/setup
new file mode 100755
index 0000000000..a9bf588e2f
--- /dev/null
+++ b/docker/etc/s6/syslogd/setup
@@ -0,0 +1 @@
+#!/bin/bash
diff --git a/docker/etc/ssh/sshd_config b/docker/etc/ssh/sshd_config
new file mode 100644
index 0000000000..991b5196a0
--- /dev/null
+++ b/docker/etc/ssh/sshd_config
@@ -0,0 +1,33 @@
+Port 22
+Protocol 2
+
+AddressFamily any
+ListenAddress 0.0.0.0
+ListenAddress ::
+
+LogLevel INFO
+
+HostKey /data/ssh/ssh_host_ed25519_key
+HostKey /data/ssh/ssh_host_rsa_key
+HostKey /data/ssh/ssh_host_dsa_key
+HostKey /data/ssh/ssh_host_ecdsa_key
+
+AuthorizedKeysFile .ssh/authorized_keys
+
+UseDNS no
+AllowAgentForwarding no
+AllowTcpForwarding no
+PrintMotd no
+PrintLastLog no
+
+PermitUserEnvironment yes
+PermitRootLogin no
+ChallengeResponseAuthentication no
+PasswordAuthentication no
+PermitEmptyPasswords no
+
+AllowUsers git
+
+Banner none
+Subsystem sftp /usr/lib/ssh/sftp-server
+UsePrivilegeSeparation no
diff --git a/docker/etc/templates/app.ini b/docker/etc/templates/app.ini
new file mode 100644
index 0000000000..0c4b9d6595
--- /dev/null
+++ b/docker/etc/templates/app.ini
@@ -0,0 +1,24 @@
+[repository]
+ROOT = /data/git/repositories
+
+[repository.upload]
+TEMP_PATH = /data/gitea/uploads
+
+[server]
+APP_DATA_PATH = /data/gitea
+
+[database]
+HOST = mysql:3306
+PATH = /data/gitea/gitea.db
+
+[session]
+PROVIDER_CONFIG = /data/gitea/sessions
+
+[picture]
+AVATAR_UPLOAD_PATH = /data/gitea/avatars
+
+[attachment]
+PATH = /data/gitea/attachments
+
+[log]
+ROOT_PATH = /data/gitea/log