Dockerfile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. FROM debian:wheezy-backports
  2. #FROM google/golang:latest
  3. #RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list
  4. RUN apt-get update
  5. RUN apt-get install -y gcc libc6-dev make --no-install-recommends
  6. # install golang
  7. ENV GOLANG_VERSION 1.4.3
  8. RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
  9. | tar -v -C /usr/src -xz
  10. RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
  11. ENV PATH /usr/src/go/bin:$PATH
  12. ENV GOPATH /gopath
  13. ENV TAGS="sqlite redis memcache cert"
  14. COPY . /gopath/src/github.com/gogits/gogs/
  15. #RUN apt-cache search openssh-server
  16. RUN apt-get install -y openssh-server rsync
  17. ##RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list \
  18. # && apt-get update \
  19. # && apt-get install -y -t wheezy-backports openssh-server rsync
  20. # set the working directory and add current stuff
  21. WORKDIR /gopath/src/github.com/gogits/gogs/
  22. RUN go get -v -tags "$TAGS"
  23. RUN go build -tags "$TAGS"
  24. RUN useradd --shell /bin/bash --system --comment gogits git
  25. RUN mkdir /var/run/sshd
  26. # SSH login fix. Otherwise user is kicked off after login
  27. RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
  28. RUN sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config
  29. RUN echo "export VISIBLE=now" >> /etc/profile
  30. RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
  31. # setup server keys on startup
  32. RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config
  33. RUN echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config
  34. RUN echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config
  35. RUN echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config
  36. RUN echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config
  37. RUN echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
  38. # prepare data
  39. #ENV USER="git" HOME="/home/git"
  40. ENV GOGS_CUSTOM /data/gogs
  41. RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
  42. EXPOSE 22 3000
  43. ENTRYPOINT []
  44. CMD ["./docker/start.sh"]