Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

82 lines
2.6KB

  1. FROM debian:stretch
  2. ENV GO_VERSION 1.9
  3. ENV GO_OS linux
  4. ENV GO_ARCH amd64
  5. ENV GOGS_CUSTOM /data/gogs
  6. ENV GIT_HOME /home/git
  7. # Install dependencies
  8. RUN apt-get update \
  9. && apt-get install -y --no-install-recommends \
  10. git wget ca-certificates openssh-server mariadb-client \
  11. && rm -rf /var/lib/apt/lists/*
  12. RUN mkdir -p /data/gogs/data \
  13. && mkdir -p /data/gogs/conf \
  14. && mkdir -p /data/gogs/log \
  15. && mkdir -p /data/gogs/gogs-repositories \
  16. && mkdir -p /data/ssh
  17. # Create git user for Gogs
  18. RUN export PUID=${PUID:-1000} \
  19. && export PGID=${PGID:-1000} \
  20. && addgroup --gid ${PGID} git \
  21. && adduser --uid ${PUID} --ingroup git --disabled-login --gecos 'Gogs Git User' --home ${GIT_HOME} --shell /bin/bash git \
  22. && ln -s /data/ssh ${GIT_HOME}/.ssh
  23. RUN chown -R git:git /data
  24. RUN chown -R git:git ${GIT_HOME}
  25. RUN echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" > /etc/profile.d/gogs.sh
  26. RUN echo "export GOROOT=${GIT_HOME}/local/go" | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null \
  27. && echo "export GOPATH=${GIT_HOME}/go" | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null \
  28. && echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null
  29. # ############## USER git ########################
  30. USER git
  31. # Install Golang
  32. RUN cd $HOME \
  33. && mkdir local \
  34. && cd local \
  35. && wget https://storage.googleapis.com/golang/go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz \
  36. && tar zxvf go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz \
  37. && rm go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz
  38. # Install Gogs
  39. RUN . /etc/profile.d/gogs.sh \
  40. && ${GOROOT}/bin/go get -u -tags "cert" github.com/gogs/gogs \
  41. && cd $GOPATH/src/github.com/gogs/gogs \
  42. && go build -tags "cert"
  43. # TODO:
  44. # clean stuff
  45. # https://github.com/gogs/gogs/blob/master/docker/finalize.sh
  46. # Clean stuff
  47. RUN rm -r $HOME/go/src/github.com/gogs/gogs/.git
  48. #RUN rm -r $HOME/local
  49. # Configuration
  50. # $HOME doesn't work with COPY
  51. RUN mkdir -p ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf
  52. COPY app.ini ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/
  53. # LDAP
  54. RUN mkdir -p ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/auth.d
  55. COPY ldap.conf ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/auth.d/
  56. # ############## USER root ########################
  57. USER root
  58. COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
  59. RUN chmod 755 /usr/local/bin/docker-entrypoint.sh
  60. #ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  61. #CMD gosu git ${GOPATH}/src/github.com/gogs/gogs/gogs web
  62. ENTRYPOINT []
  63. CMD ["/usr/local/bin/docker-entrypoint.sh"]