aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-08-17 17:15:03 +0800
committer无闻 <u@gogs.io>2015-08-17 17:15:03 +0800
commitf0067e8f78eaa9203cc6743116e7a2a3f82fe7eb (patch)
treed06c041490994fb4015c17737156c55cb877601c /Dockerfile
parent407385db7eae3ccdef235ac68273364bd704d0bd (diff)
parent9371fbe71a10f9449c805a1fd27968397d4f7cdb (diff)
Merge pull request #1494 from codeskyblue/develop
docker support ssh
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile38
1 files changed, 30 insertions, 8 deletions
diff --git a/Dockerfile b/Dockerfile
index bb2ed8d3..a6d23cfc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,17 +1,39 @@
FROM google/golang:latest
+MAINTAINER codeskyblue@gmail.com
-ENV TAGS="sqlite redis memcache cert" USER="git" HOME="/home/git"
+RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list
+RUN apt-get update
+RUN apt-get install -y openssh-server rsync
+# set the working directory and add current stuff
COPY . /gopath/src/github.com/gogits/gogs/
WORKDIR /gopath/src/github.com/gogits/gogs/
-RUN go get -v -tags="$TAGS" github.com/gogits/gogs \
- && go build -tags="$TAGS" \
- && useradd -d $HOME -m $USER \
- && chown -R $USER .
+RUN go get -v -tags "sqlite redis memcache cert"
+RUN go build -tags "sqlite redis memcache cert"
-USER $USER
+RUN useradd --shell /bin/bash --system --comment gogits git
-ENTRYPOINT [ "./gogs" ]
+RUN mkdir /var/run/sshd
+# SSH login fix. Otherwise user is kicked off after login
+RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
+RUN sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config
+RUN echo "export VISIBLE=now" >> /etc/profile
+RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
-CMD [ "web" ]
+# setup server keys on startup
+RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config
+RUN echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config
+RUN echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config
+RUN echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config
+RUN echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config
+RUN echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
+
+# prepare data
+#ENV USER="git" HOME="/home/git"
+ENV GOGS_CUSTOM /data/gogs
+RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
+
+EXPOSE 22 3000
+ENTRYPOINT []
+CMD ["./docker/start.sh"]