github地址:https://github.com/LinuxEA-Mark/docker-subversion1.9.4
一键安装:
curl -Lks4 https://raw.githubusercontent.com/LinuxEA-Mark/docker-subversion1.9.4/master/docker-create-svn.sh |bash
DockerfileDockerfile非常简单,就是安装和创建目录,以及初始化脚本在构建好后会放在/下,启动时会执行
FROM alpine
MAINTAINER mark www.linuxea.com
ENV SPA /data/docker/svn
RUN apk add --update subversion curl
&& rm /var/cache/apk/*
&& mkdir $SPA -p
&& curl -Lks4 https://raw.githubusercontent.com/LinuxEA-Mark/docker-subversion1.9.4/master/initialization.sh -o /initialization.sh
&& chmod +x /initialization.sh
ENTRYPOINT ["/initialization.sh"]
initialization初始化脚本,初始化脚本主要在启动时会判断目录是否空,如果空则执行,但是这里需要注意的是启动前我的目录是已经挂在好的
#!/bin/sh
#########################################################################
# File Name: initialization.sh
# Author: mark www.linuxea.com
# Email: usertzc@gmail.com
# Version:
# Created Time: 2016年12月26日 星期一 14时03分46秒
#########################################################################
SPA=/data/docker/svn
if [ "$(ls -A $SPA)" ];then
svnserve -d -r /data/docker/svn && tail -f /etc/passwd
else
svnadmin create $SPA
sed -i 's/# anon-access = read/anon-access = none/g' $SPA/conf/svnserve.conf && sed -i 's/# password-db = passwd/password-db = passwd/g' $SPA/conf/svnserve.conf && sed -i 's/# auth-access = write/auth-access = write/g' $SPA/conf/svnserve.conf && sed -i 's/# realm = My First Repository/realm = web1/g' $SPA/conf/svnserve.conf && sed -i 's/# authz-db = authz/authz-db = authz/g' $SPA/conf/svnserve.conf && echo linuxea=mark >> $SPA/conf/passwd && curl -Lks4 https://raw.githubusercontent.com/LinuxEA-Mark/docker-subversion1.9.4/master/authz >> $SPA/conf/authz && svnserve -d -r /data/docker/svn && tail -f /etc/passwd
fi
docker-compose
version: '2'
services:
svb1.9.4:
build:
context: https://raw.githubusercontent.com/LinuxEA-Mark/docker-subversion1.9.4/master/Dockerfile
container_name: svn
restart: always
network_mode: "host"
volumes:
- /data/docker/subversion:/data/docker/svn/