diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..951b138 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Force Unix style line endings for files that will be copied into the Docker image +*.sh text eol=lf + +# Auto detect text files and perform LF normalization on the rest +* text=auto diff --git a/Dockerfile b/Dockerfile index 811c2f5..482f80e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,17 @@ FROM alpine:3.20.3 -CMD [ "/usr/bin/svnserve", "--daemon", "--foreground", "--root", "/var/opt/svn" ] EXPOSE 3690 + HEALTHCHECK CMD netstat -ln | grep 3690 || exit 1 + VOLUME [ "/var/opt/svn" ] WORKDIR /var/opt/svn +ENV SVNSERVE_ARGS= + RUN apk add --no-cache \ subversion==1.14.3-r2 \ wget==1.24.5-r0 + +COPY docker-entrypoint.sh / +CMD [ "/docker-entrypoint.sh" ] diff --git a/README.md b/README.md index d1c3eb5..5beb1ac 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,33 @@ services: - /home/svn:/var/opt/svn ``` +### Start the Subversion server with custom arguments + +To define arguments to be passed to the Subversion server, set the `SVNSERVE_ARGS` environmental variable: + +#### ...via `docker run` + +```sh +docker run ... SVNSERVE_ARGS="--option1 value1 --option2 value2" ... garethflowers/svn-server +``` + +#### ...via `docker compose` + +```sh +services: + svn: + image: garethflowers/svn-server + environment: + - SVNSERVE_ARGS=--option1 value1 --option2 value2 + ... +``` + +### List available command line options + +```sh +docker exec -it CONTAINER_NAME svnserve --help +``` + ### Creating a new SVN Repository Use `svnadmin` within your container to create and manage repositories. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..ab3d8c3 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +/usr/bin/svnserve --daemon --foreground --root /var/opt/svn $SVNSERVE_ARGS