1- #Build stage
1+ # Build stage
22FROM docker.io/library/golang:1.21-alpine3.18 AS build-env
33
44ARG GOPROXY
@@ -10,19 +10,35 @@ ENV TAGS "bindata timetzdata $TAGS"
1010ARG CGO_EXTRA_CFLAGS
1111
1212#Build deps
13- RUN apk --no-cache add build-base git nodejs npm
13+ RUN apk --no-cache add \
14+ build-base \
15+ git \
16+ nodejs \
17+ npm \
18+ && rm -rf /var/cache/apk/*
1419
15- #Setup repo
20+ # Setup repo
1621COPY . ${GOPATH}/src/code.gitea.io/gitea
1722WORKDIR ${GOPATH}/src/code.gitea.io/gitea
1823
19- #Checkout version if set
24+ # Checkout version if set
2025RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2126 && make clean-all build
2227
2328# Begin env-to-ini build
2429RUN go build contrib/environment-to-ini/environment-to-ini.go
2530
31+ # Copy local files
32+ COPY docker/rootless /tmp/local
33+
34+ # Set permissions
35+ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
36+ /tmp/local/usr/local/bin/docker-setup.sh \
37+ /tmp/local/usr/local/bin/gitea \
38+ /go/src/code.gitea.io/gitea/gitea \
39+ /go/src/code.gitea.io/gitea/environment-to-ini
40+ RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
41+
2642FROM docker.io/library/alpine:3.18
2743LABEL maintainer="
[email protected] "
2844
@@ -35,7 +51,8 @@ RUN apk --no-cache add \
3551 gettext \
3652 git \
3753 curl \
38- gnupg
54+ gnupg \
55+ && rm -rf /var/cache/apk/*
3956
4057RUN addgroup \
4158 -S -g 1000 \
@@ -51,26 +68,23 @@ RUN addgroup \
5168RUN mkdir -p /var/lib/gitea /etc/gitea
5269RUN chown git:git /var/lib/gitea /etc/gitea
5370
54- COPY docker/rootless /
71+ COPY --from=build-env /tmp/local /
5572COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
5673COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
5774COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
58- RUN chmod 755 /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-setup.sh /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
59- RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh
6075
61- #git:git
76+ # git:git
6277USER 1000:1000
6378ENV GITEA_WORK_DIR /var/lib/gitea
6479ENV GITEA_CUSTOM /var/lib/gitea/custom
6580ENV GITEA_TEMP /tmp/gitea
6681ENV TMPDIR /tmp/gitea
6782
68- #TODO add to docs the ability to define the ini to load (useful to test and revert a config)
83+ # TODO add to docs the ability to define the ini to load (useful to test and revert a config)
6984ENV GITEA_APP_INI /etc/gitea/app.ini
7085ENV HOME "/var/lib/gitea/git"
7186VOLUME ["/var/lib/gitea", "/etc/gitea"]
7287WORKDIR /var/lib/gitea
7388
7489ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
7590CMD []
76-
0 commit comments