1
- #Build stage
1
+ # Build stage
2
2
FROM docker.io/library/golang:1.21-alpine3.18 AS build-env
3
3
4
4
ARG GOPROXY
@@ -10,19 +10,35 @@ ENV TAGS "bindata timetzdata $TAGS"
10
10
ARG CGO_EXTRA_CFLAGS
11
11
12
12
#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/*
14
19
15
- #Setup repo
20
+ # Setup repo
16
21
COPY . ${GOPATH}/src/code.gitea.io/gitea
17
22
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
18
23
19
- #Checkout version if set
24
+ # Checkout version if set
20
25
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
21
26
&& make clean-all build
22
27
23
28
# Begin env-to-ini build
24
29
RUN go build contrib/environment-to-ini/environment-to-ini.go
25
30
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
+
26
42
FROM docker.io/library/alpine:3.18
27
43
LABEL maintainer="
[email protected] "
28
44
@@ -35,7 +51,8 @@ RUN apk --no-cache add \
35
51
gettext \
36
52
git \
37
53
curl \
38
- gnupg
54
+ gnupg \
55
+ && rm -rf /var/cache/apk/*
39
56
40
57
RUN addgroup \
41
58
-S -g 1000 \
@@ -51,26 +68,23 @@ RUN addgroup \
51
68
RUN mkdir -p /var/lib/gitea /etc/gitea
52
69
RUN chown git:git /var/lib/gitea /etc/gitea
53
70
54
- COPY docker/rootless /
71
+ COPY --from=build-env /tmp/local /
55
72
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
56
73
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
57
74
COPY --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
60
75
61
- #git:git
76
+ # git:git
62
77
USER 1000:1000
63
78
ENV GITEA_WORK_DIR /var/lib/gitea
64
79
ENV GITEA_CUSTOM /var/lib/gitea/custom
65
80
ENV GITEA_TEMP /tmp/gitea
66
81
ENV TMPDIR /tmp/gitea
67
82
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)
69
84
ENV GITEA_APP_INI /etc/gitea/app.ini
70
85
ENV HOME "/var/lib/gitea/git"
71
86
VOLUME ["/var/lib/gitea", "/etc/gitea"]
72
87
WORKDIR /var/lib/gitea
73
88
74
89
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
75
90
CMD []
76
-
0 commit comments