Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. FROM golang:alpine3.11 AS binarybuilder
  2. RUN apk --no-cache --no-progress add --virtual \
  3. build-deps \
  4. build-base \
  5. git \
  6. linux-pam-dev
  7. WORKDIR /go/src/github.com/G-Node/gogs
  8. COPY . .
  9. RUN make build-no-gen TAGS="cert pam"
  10. FROM alpine:3.11
  11. ADD https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64 /usr/sbin/gosu
  12. RUN chmod +x /usr/sbin/gosu \
  13. && echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories \
  14. && apk --no-cache --no-progress add \
  15. bash \
  16. ca-certificates \
  17. curl \
  18. git \
  19. linux-pam \
  20. openssh \
  21. s6 \
  22. shadow \
  23. socat \
  24. tzdata \
  25. rsync \
  26. python \
  27. py-pip
  28. RUN pip install supervisor pyyaml
  29. RUN mkdir /git-annex
  30. ENV PATH="${PATH}:/git-annex/git-annex.linux"
  31. RUN apk add --no-cache git openssh curl
  32. RUN curl -Lo /git-annex/git-annex-standalone-amd64.tar.gz https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-amd64.tar.gz
  33. RUN cd /git-annex && tar -xzf git-annex-standalone-amd64.tar.gz && rm git-annex-standalone-amd64.tar.gz
  34. RUN apk del --no-cache curl
  35. RUN ln -s /git-annex/git-annex.linux/git-annex-shell /bin/git-annex-shell
  36. ENV GOGS_CUSTOM /data/gogs
  37. # Configure LibC Name Service
  38. COPY docker/nsswitch.conf /etc/nsswitch.conf
  39. WORKDIR /app/gogs
  40. COPY docker ./docker
  41. COPY --from=binarybuilder /go/src/github.com/G-Node/gogs/gogs .
  42. RUN ./docker/finalize.sh
  43. # Configure Docker Container
  44. VOLUME ["/data", "/backup"]
  45. EXPOSE 22 3000
  46. ENTRYPOINT ["/app/gogs/docker/start.sh"]
  47. CMD ["/bin/s6-svscan", "/app/gogs/docker/s6/"]