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.

Dockerfile.rootless 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ###################################
  2. #Build stage
  3. FROM golang:1.16-alpine3.13 AS build-env
  4. ARG GOPROXY
  5. ENV GOPROXY ${GOPROXY:-direct}
  6. ARG GITEA_VERSION
  7. ARG TAGS="sqlite sqlite_unlock_notify"
  8. ENV TAGS "bindata timetzdata $TAGS"
  9. ARG CGO_EXTRA_CFLAGS
  10. #Build deps
  11. RUN apk --no-cache add build-base git nodejs npm
  12. #Setup repo
  13. COPY . ${GOPATH}/src/code.gitea.io/gitea
  14. WORKDIR ${GOPATH}/src/code.gitea.io/gitea
  15. #Checkout version if set
  16. RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
  17. && make clean-all build
  18. # Begin env-to-ini build
  19. RUN go build contrib/environment-to-ini/environment-to-ini.go
  20. FROM alpine:3.13
  21. LABEL maintainer="maintainers@gitea.io"
  22. EXPOSE 2222 3000
  23. RUN apk --no-cache add \
  24. bash \
  25. ca-certificates \
  26. gettext \
  27. git \
  28. curl \
  29. gnupg
  30. RUN addgroup \
  31. -S -g 1000 \
  32. git && \
  33. adduser \
  34. -S -H -D \
  35. -h /var/lib/gitea/git \
  36. -s /bin/bash \
  37. -u 1000 \
  38. -G git \
  39. git
  40. RUN mkdir -p /var/lib/gitea /etc/gitea
  41. RUN chown git:git /var/lib/gitea /etc/gitea
  42. COPY docker/rootless /
  43. COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea
  44. COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
  45. USER git:git
  46. ENV GITEA_WORK_DIR /var/lib/gitea
  47. ENV GITEA_CUSTOM /var/lib/gitea/custom
  48. ENV GITEA_TEMP /tmp/gitea
  49. ENV TMPDIR /tmp/gitea
  50. #TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
  51. ENV GITEA_APP_INI /etc/gitea/app.ini
  52. ENV HOME "/var/lib/gitea/git"
  53. VOLUME ["/var/lib/gitea", "/etc/gitea"]
  54. WORKDIR /var/lib/gitea
  55. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  56. CMD []