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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Build stage
  2. FROM docker.io/library/golang:1.22-alpine3.19 AS build-env
  3. ARG GOPROXY
  4. ENV GOPROXY ${GOPROXY:-direct}
  5. ARG GITEA_VERSION
  6. ARG TAGS="sqlite sqlite_unlock_notify"
  7. ENV TAGS "bindata timetzdata $TAGS"
  8. ARG CGO_EXTRA_CFLAGS
  9. # Build deps
  10. RUN apk --no-cache add \
  11. build-base \
  12. git \
  13. nodejs \
  14. npm \
  15. && rm -rf /var/cache/apk/*
  16. # Setup repo
  17. COPY . ${GOPATH}/src/code.gitea.io/gitea
  18. WORKDIR ${GOPATH}/src/code.gitea.io/gitea
  19. # Checkout version if set
  20. RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
  21. && make clean-all build
  22. # Begin env-to-ini build
  23. RUN go build contrib/environment-to-ini/environment-to-ini.go
  24. # Copy local files
  25. COPY docker/root /tmp/local
  26. # Set permissions
  27. RUN chmod 755 /tmp/local/usr/bin/entrypoint \
  28. /tmp/local/usr/local/bin/gitea \
  29. /tmp/local/etc/s6/gitea/* \
  30. /tmp/local/etc/s6/openssh/* \
  31. /tmp/local/etc/s6/.s6-svscan/* \
  32. /go/src/code.gitea.io/gitea/gitea \
  33. /go/src/code.gitea.io/gitea/environment-to-ini
  34. RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
  35. FROM docker.io/library/alpine:3.19
  36. LABEL maintainer="maintainers@gitea.io"
  37. EXPOSE 22 3000
  38. RUN apk --no-cache add \
  39. bash \
  40. ca-certificates \
  41. curl \
  42. gettext \
  43. git \
  44. linux-pam \
  45. openssh \
  46. s6 \
  47. sqlite \
  48. su-exec \
  49. gnupg \
  50. && rm -rf /var/cache/apk/*
  51. RUN addgroup \
  52. -S -g 1000 \
  53. git && \
  54. adduser \
  55. -S -H -D \
  56. -h /data/git \
  57. -s /bin/bash \
  58. -u 1000 \
  59. -G git \
  60. git && \
  61. echo "git:*" | chpasswd -e
  62. ENV USER git
  63. ENV GITEA_CUSTOM /data/gitea
  64. VOLUME ["/data"]
  65. ENTRYPOINT ["/usr/bin/entrypoint"]
  66. CMD ["/bin/s6-svscan", "/etc/s6"]
  67. COPY --from=build-env /tmp/local /
  68. COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
  69. COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
  70. COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh