mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 05:30:45 +00:00
Alex Palaistras
f9625a8e66
This improves caching by consolidating build steps and using a multi-stage build step for the binary installation.
29 lines
1.3 KiB
Bash
Executable File
29 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
# Create configuration file from collected templates.
|
|
envsubst < /etc/gitea/config.ini.template > /etc/gitea/config.ini
|
|
|
|
# Create data directories and correct permissions for data files.
|
|
chown -R git:git /etc/gitea
|
|
|
|
# Initialize default condiguration if needed.
|
|
if ! test -f /var/lib/gitea/gitea.db; then
|
|
# Set up database.
|
|
gosu git /usr/bin/gitea -c /etc/gitea/config.ini migrate
|
|
|
|
# Set up LDAP authentication via local service.
|
|
gosu git /usr/bin/gitea -c /etc/gitea/config.ini admin auth add-ldap \
|
|
--name "LDAP" --host "${GITEA_AUTH_LDAP_HOST}" --port "${GITEA_AUTH_LDAP_PORT}" \
|
|
--synchronize-users --security-protocol unencrypted \
|
|
--bind-dn "uid=${GITEA_AUTH_LDAP_BIND_UID},ou=people,dc=ldap,dc=local" --bind-password "${GITEA_AUTH_LDAP_BIND_PASSWORD}" \
|
|
--user-search-base "ou=people,dc=ldap,dc=local" --user-filter "(&(memberof=cn=gitea_user,ou=groups,dc=ldap,dc=local)(|(uid=%[1]s)(mail=%[1]s)))" \
|
|
--admin-filter "(memberof=cn=gitea_admin,ou=groups,dc=ldap,dc=local)" \
|
|
--username-attribute "uid" --email-attribute "mail" \
|
|
--firstname-attribute "givenName" --surname-attribute "sn" --avatar-attribute "jpegPhoto"
|
|
fi
|
|
|
|
# Run entrypoint under specific user.
|
|
exec gosu git /usr/bin/gitea -c /etc/gitea/config.ini web "$@"
|