Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. FROM google/golang:latest
  2. MAINTAINER codeskyblue@gmail.com
  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 openssh-server rsync libpam-dev
  6. # set the working directory and add current stuff
  7. COPY . /gopath/src/github.com/gogits/gogs/
  8. WORKDIR /gopath/src/github.com/gogits/gogs/
  9. RUN go get -v -tags "sqlite redis memcache cert pam"
  10. RUN go build -tags "sqlite redis memcache cert pam"
  11. RUN useradd --shell /bin/bash --system --comment gogits git
  12. RUN mkdir /var/run/sshd
  13. # SSH login fix. Otherwise user is kicked off after login
  14. RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
  15. RUN sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config
  16. RUN echo "export VISIBLE=now" >> /etc/profile
  17. RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
  18. # setup server keys on startup
  19. RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config
  20. RUN echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config
  21. RUN echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config
  22. RUN echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config
  23. RUN echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config
  24. RUN echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
  25. # prepare data
  26. #ENV USER="git" HOME="/home/git"
  27. ENV GOGS_CUSTOM /data/gogs
  28. RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
  29. EXPOSE 22 3000
  30. ENTRYPOINT []
  31. CMD ["./docker/start.sh"]