From 3dc19702e0549c8b0de88b86d6b260944aa0a20d Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Wed, 6 Apr 2016 10:21:51 -0700 Subject: [PATCH] updates Signed-off-by: Jess Frazelle --- gitiles/Dockerfile | 33 +++++++++++++++++---------------- gitiles/start.sh | 22 +++++++++++++++++++--- gitserver/Dockerfile | 2 +- gitserver/start.sh | 5 +++++ 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/gitiles/Dockerfile b/gitiles/Dockerfile index bb158c3..acbbcb5 100644 --- a/gitiles/Dockerfile +++ b/gitiles/Dockerfile @@ -1,18 +1,19 @@ FROM java:8-alpine MAINTAINER Jessica Frazelle -RUN apk --update add \ - apache-ant \ - bash \ - git \ - perl \ - python \ - zip \ - --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \ - && rm -rf /var/cache/apk/* - # install buck -RUN git clone --depth 1 https://github.com/facebook/buck.git /buck \ +RUN buildDeps=' \ + apache-ant \ + bash \ + git \ + perl \ + python \ + zip \ + ' \ + set -x \ + && apk --update add $buildDeps \ + --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \ + && git clone --depth 1 https://github.com/facebook/buck.git /buck \ && ( \ cd /buck \ && ant \ @@ -23,12 +24,12 @@ RUN git clone --depth 1 https://github.com/facebook/buck.git /buck \ cd /gitiles \ && touch .nobuckcheck \ && git submodule update --init \ - && buck build all \ - && mv buck-out/gen/gitiles/gitiles.war /gitiles.war \ + && buck build gitiles-dev:dev \ ) \ - && rm -rf /gitiles \ - && rm -rf /buck + && apk del $buildDeps \ + && rm -rf /buck \ + && rm -rf /var/cache/apk/* -COPY ./start.sh /start.sh +COPY start.sh /start.sh ENTRYPOINT [ "/start.sh" ] diff --git a/gitiles/start.sh b/gitiles/start.sh index 34a574c..ffefa1f 100755 --- a/gitiles/start.sh +++ b/gitiles/start.sh @@ -1,12 +1,28 @@ #!/bin/sh set -e -ROOT="/gitiles" +ROOT=/gitiles PROPERTIES= if [ "x$1" != "x" ]; then - PROPERTIES="-Dcom.google.gitiles.configPath=$1" + PROPERTIES="-Dcom.google.gitiles.configPath=$1" +else + PROPERTIES="-Dcom.google.gitiles.configPath=/gitfiles.config" + cat > /gitfiles.config <<-EOF + [gitiles] + # Repositories placed here + basePath = /home/git + # Do not check they are exported + exportAll = true + # This URL will be displayed as clone URL. DO NOT FORGET TRAILING SLASH! + baseGitUrl = git@g.j3ss.co: + # Title of site (doh) + siteTitle = Gitiles - git.j3ss.co + # I dunno why, but it is have to be configured. + canonicalHostName = git.j3ss.co + EOF fi + PROPERTIES="$PROPERTIES -Dcom.google.gitiles.sourcePath=$ROOT" -exec java $PROPERTIES -jar "$ROOT/buck-out/gen/gitiles/gitiles.war" +exec java $PROPERTIES -jar "$ROOT/buck-out/gen/gitiles-dev/dev.jar" diff --git a/gitserver/Dockerfile b/gitserver/Dockerfile index 3ea1dc2..997987e 100644 --- a/gitserver/Dockerfile +++ b/gitserver/Dockerfile @@ -28,7 +28,7 @@ RUN apk update && apk add \ echo 'git init --bare $1'; \ echo 'chown -R git:git $1'; \ echo '}'; \ - } > /home/git/.bashrc + } > /etc/profile ENV HOME /home/git EXPOSE 22 diff --git a/gitserver/start.sh b/gitserver/start.sh index 9d9e33b..188997d 100755 --- a/gitserver/start.sh +++ b/gitserver/start.sh @@ -11,8 +11,13 @@ if [ ! -f "${HOSTKEY}" ]; then ssh-keygen -A fi +mkdir -p ${HOME}/.ssh +source /etc/profile [ "$PUBKEY" ] && echo "$PUBKEY" > ${HOME}/.ssh/authorized_keys +chown -R git:git ${HOME} +chmod -R 755 ${HOME} + # Fix permissions, if writable if [ -w ${HOME}/.ssh ]; then chown git:git ${HOME}/.ssh && chmod 700 ${HOME}/.ssh/