Skip to content

Commit

Permalink
use a named pipe and --log-file to output logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Guiorgy committed Aug 28, 2024
1 parent bed50ff commit adbe79d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.20.2

CMD [ "/usr/bin/svnserve", "--daemon", "--foreground", "--root", "/var/opt/svn" ]
COPY docker-entrypoint.sh /
CMD [ "/docker-entrypoint.sh" ]
EXPOSE 3690
HEALTHCHECK CMD netstat -ln | grep 3690 || exit 1
VOLUME [ "/var/opt/svn" ]
Expand Down
18 changes: 18 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

# create a pipe for svnserve logs
rm -f /var/svn/svnlogs
mkfifo /var/svn/svnlogs

# run the SVN service in the background
/usr/bin/svnserve --daemon --root /var/opt/svn --log-file=/var/svn/svnlogs &
# remember the PID of the SVN server
SVNSERVE_PID=$!

# redirect svnserve logs to stdout
cat /var/svn/svnlogs

# stop the SVN server running in the background
kill --signal SIGTERM $SVNSERVE_PID

0 comments on commit adbe79d

Please sign in to comment.