Dockerfile 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FROM golang:1.9-alpine3.7 as builder
  2. RUN set -eu; apk --no-cache add \
  3. gcc \
  4. git \
  5. make \
  6. musl-dev
  7. ENV GOPATH="/go"
  8. ENV SRC_DIR="${GOPATH}/src/code.gitea.io/gitea"
  9. WORKDIR "$SRC_DIR"
  10. ARG gitea_version
  11. ARG gitea_checksum
  12. ARG gitea_repo_url
  13. RUN set -eu; git clone --branch "v${gitea_version}" --depth 1 --no-checkout "$gitea_repo_url" .; \
  14. git checkout "$gitea_checksum"
  15. ARG gitea_build_tags
  16. RUN set -eu; TAGS="$gitea_build_tags" make generate build
  17. FROM alpine:3.7
  18. LABEL maintainer="Piotr Orzechowski [orzechowski.tech]"
  19. RUN set -eu; apk --no-cache add \
  20. bash \
  21. ca-certificates \
  22. curl \
  23. git \
  24. linux-pam \
  25. openssh \
  26. s6 \
  27. sqlite \
  28. su-exec \
  29. tzdata
  30. RUN set -eu; addgroup -S -g 1000 git; \
  31. adduser -S -D -G git -u 1000 -s '/bin/bash' -H -h '/data/git' git
  32. RUN set -euo pipefail; echo "root:$(head -c 32 /dev/urandom | base64)" | chpasswd; \
  33. echo "git:$(head -c 32 /dev/urandom | base64)" | chpasswd
  34. COPY --from=builder "/go/src/code.gitea.io/gitea/gitea" "/usr/local/bin/gitea"
  35. COPY files /
  36. VOLUME ["/data"]
  37. ENV GITEA_CUSTOM="/data/gitea"
  38. ENTRYPOINT ["/usr/local/bin/entrypoint"]
  39. EXPOSE 22 3000