You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6KB

  1. FROM golang:1.13-alpine3.10 as builder
  2. RUN set -eu; \
  3. apk --no-cache add \
  4. gcc \
  5. git \
  6. make \
  7. musl-dev
  8. ENV GOPATH="/go"
  9. ENV SRC_DIR="${GOPATH}/src/code.gitea.io/gitea"
  10. WORKDIR "$SRC_DIR"
  11. ARG gitea_version
  12. ARG gitea_checksum
  13. ARG gitea_repo_url="https://github.com/go-gitea/gitea.git"
  14. RUN set -eu; \
  15. git clone --branch "v${gitea_version}" --depth 1 --no-checkout "$gitea_repo_url" .; \
  16. git checkout "$gitea_checksum"
  17. ARG GITEA_BUILD_TAGS="bindata sqlite"
  18. RUN set -eu; \
  19. TAGS="$GITEA_BUILD_TAGS" make generate build
  20. FROM alpine:3.10
  21. ARG source
  22. LABEL maintainer='Piotr Orzechowski [orzechowski.tech]' source="$source"
  23. RUN set -euo pipefail; \
  24. apk --no-cache add \
  25. bash \
  26. ca-certificates \
  27. curl \
  28. git \
  29. linux-pam \
  30. openssh \
  31. s6 \
  32. sqlite \
  33. su-exec \
  34. tzdata; \
  35. addgroup -S -g 1000 git; \
  36. adduser -S -D -G git -u 1000 -s '/bin/bash' -H -h '/data/git' git; \
  37. echo "root:$(strings /dev/urandom | tr -d '[:cntrl:]' | head -c 128)" | chpasswd; \
  38. echo "git:$(strings /dev/urandom | tr -d '[:cntrl:]' | head -c 128)" | chpasswd
  39. COPY files /
  40. COPY --from=builder "/go/src/code.gitea.io/gitea/gitea" "/usr/local/bin/gitea"
  41. RUN set -eu; \
  42. mkdir '/service'; \
  43. ln -s '/etc/s6/.s6-svscan' '/service/.s6-svscan'; \
  44. ln -s '/etc/s6/syslogd' '/service/syslogd'; \
  45. ln -s '/etc/s6/openssh' '/service/openssh'; \
  46. ln -s '/etc/s6/gitea' '/service/gitea'
  47. VOLUME ["/data"]
  48. ENV GITEA_CUSTOM="/data/gitea"
  49. CMD ["/bin/s6-svscan", "/service"]
  50. EXPOSE 22 3000