Dockerfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ###################################
  2. #Build stage
  3. FROM golang:1.11-alpine3.9 AS build-env
  4. ARG GITEA_VERSION
  5. ARG TAGS="sqlite sqlite_unlock_notify"
  6. ENV TAGS "bindata $TAGS"
  7. #Build deps
  8. RUN apk --no-cache add build-base git
  9. #Setup repo
  10. COPY . ${GOPATH}/src/code.gitea.io/gitea
  11. WORKDIR ${GOPATH}/src/code.gitea.io/gitea
  12. #Checkout version if set
  13. RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
  14. && make clean generate build
  15. FROM alpine:3.9
  16. LABEL maintainer="maintainers@gitea.io"
  17. EXPOSE 22 3000
  18. RUN apk --no-cache add \
  19. bash \
  20. ca-certificates \
  21. curl \
  22. gettext \
  23. git \
  24. linux-pam \
  25. openssh \
  26. s6 \
  27. sqlite \
  28. su-exec \
  29. tzdata
  30. RUN addgroup \
  31. -S -g 1000 \
  32. git && \
  33. adduser \
  34. -S -H -D \
  35. -h /data/git \
  36. -s /bin/bash \
  37. -u 1000 \
  38. -G git \
  39. git && \
  40. echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
  41. ENV USER git
  42. ENV GITEA_CUSTOM /data/gitea
  43. VOLUME ["/data"]
  44. ENTRYPOINT ["/usr/bin/entrypoint"]
  45. CMD ["/bin/s6-svscan", "/etc/s6"]
  46. COPY docker /
  47. COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
  48. RUN ln -s /app/gitea/gitea /usr/local/bin/gitea