Dockerfile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. FROM golang:alpine3.14 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 /gogs.io/gogs
  8. COPY . .
  9. RUN make build TAGS="cert pam"
  10. FROM alpine:3.14
  11. RUN if [ `uname -m` == "aarch64" ] ; then \
  12. export arch="arm64" ; \
  13. elif [ `uname -m` == "armv7l" ] ; then \
  14. export arch="armhf"; \
  15. else \
  16. export arch="amd64" ; \
  17. fi \
  18. && wget https://github.com/tianon/gosu/releases/download/1.11/gosu-$arch -O /usr/sbin/gosu \
  19. && chmod +x /usr/sbin/gosu \
  20. && echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories \
  21. && apk --no-cache --no-progress add \
  22. bash \
  23. ca-certificates \
  24. curl \
  25. git \
  26. linux-pam \
  27. openssh \
  28. s6 \
  29. shadow \
  30. socat \
  31. tzdata \
  32. rsync
  33. ENV GOGS_CUSTOM /data/gogs
  34. # Configure LibC Name Service
  35. COPY docker/nsswitch.conf /etc/nsswitch.conf
  36. WORKDIR /app/gogs
  37. COPY docker ./docker
  38. COPY --from=binarybuilder /gogs.io/gogs/gogs .
  39. RUN ./docker/finalize.sh
  40. # Configure Docker Container
  41. VOLUME ["/data", "/backup"]
  42. EXPOSE 22 3000
  43. ENTRYPOINT ["/app/gogs/docker/start.sh"]
  44. CMD ["/bin/s6-svscan", "/app/gogs/docker/s6/"]