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

Dockerfile.rootless 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ###################################
  2. #Build stage
  3. FROM golang:1.15-alpine3.12 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. FROM alpine:3.12
  19. LABEL maintainer="maintainers@gitea.io"
  20. EXPOSE 2222 3000
  21. RUN apk --no-cache add \
  22. bash \
  23. ca-certificates \
  24. gettext \
  25. git \
  26. gnupg
  27. RUN addgroup \
  28. -S -g 1000 \
  29. git && \
  30. adduser \
  31. -S -H -D \
  32. -h /var/lib/gitea/git \
  33. -s /bin/bash \
  34. -u 1000 \
  35. -G git \
  36. git && \
  37. echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
  38. RUN mkdir -p /var/lib/gitea /etc/gitea
  39. RUN chown git:git /var/lib/gitea /etc/gitea
  40. COPY docker/rootless /
  41. COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea
  42. RUN chown root:root /usr/local/bin/* && chmod 755 /usr/local/bin/*
  43. USER git:git
  44. ENV GITEA_WORK_DIR /var/lib/gitea
  45. ENV GITEA_CUSTOM /var/lib/gitea/custom
  46. ENV GITEA_TEMP /tmp/gitea
  47. #TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
  48. ENV GITEA_APP_INI /etc/gitea/app.ini
  49. ENV HOME "/var/lib/gitea/git"
  50. VOLUME ["/var/lib/gitea", "/etc/gitea"]
  51. WORKDIR /var/lib/gitea
  52. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  53. CMD []