|
1 | 1 | # Build stage |
2 | | -FROM docker.io/library/golang:1.21-alpine3.18 AS build-env |
| 2 | +FROM docker.io/library/golang:1.21-bookworm AS build-env |
3 | 3 |
|
4 | 4 | ARG GOPROXY |
5 | 5 | ENV GOPROXY ${GOPROXY:-direct} |
6 | 6 |
|
7 | | -ARG GITEA_VERSION |
8 | | -ARG TAGS="sqlite sqlite_unlock_notify" |
9 | | -ENV TAGS "bindata timetzdata $TAGS" |
| 7 | +ARG TAGS="" |
| 8 | +ENV TAGS "bindata $TAGS" |
10 | 9 | ARG CGO_EXTRA_CFLAGS |
11 | 10 |
|
12 | | -# Build deps |
13 | | -RUN apk --no-cache add \ |
14 | | - build-base \ |
15 | | - git \ |
16 | | - nodejs \ |
17 | | - npm \ |
18 | | - && rm -rf /var/cache/apk/* |
19 | | - |
20 | | -# Setup repo |
21 | | -COPY . ${GOPATH}/src/code.gitea.io/gitea |
22 | | -WORKDIR ${GOPATH}/src/code.gitea.io/gitea |
23 | | - |
24 | | -# Checkout version if set |
25 | | -RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ |
26 | | - && make clean-all build |
27 | | - |
28 | | -# Begin env-to-ini build |
29 | | -RUN go build contrib/environment-to-ini/environment-to-ini.go |
30 | | - |
31 | | -# Copy local files |
32 | | -COPY docker/root /tmp/local |
33 | | - |
34 | | -# Set permissions |
35 | | -RUN chmod 755 /tmp/local/usr/bin/entrypoint \ |
36 | | - /tmp/local/usr/local/bin/gitea \ |
37 | | - /tmp/local/etc/s6/gitea/* \ |
38 | | - /tmp/local/etc/s6/openssh/* \ |
39 | | - /tmp/local/etc/s6/.s6-svscan/* \ |
40 | | - /go/src/code.gitea.io/gitea/gitea \ |
41 | | - /go/src/code.gitea.io/gitea/environment-to-ini |
42 | | -RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete |
43 | | - |
44 | | -FROM docker.io/library/alpine:3.18 |
45 | | -LABEL maintainer= "[email protected]" |
46 | | - |
47 | | -EXPOSE 22 3000 |
48 | | - |
49 | | -RUN apk --no-cache add \ |
50 | | - bash \ |
51 | | - ca-certificates \ |
52 | | - curl \ |
53 | | - gettext \ |
54 | | - git \ |
55 | | - linux-pam \ |
56 | | - openssh \ |
57 | | - s6 \ |
58 | | - sqlite \ |
59 | | - su-exec \ |
60 | | - gnupg \ |
61 | | - && rm -rf /var/cache/apk/* |
62 | | - |
63 | | -RUN addgroup \ |
64 | | - -S -g 1000 \ |
65 | | - git && \ |
66 | | - adduser \ |
67 | | - -S -H -D \ |
68 | | - -h /data/git \ |
69 | | - -s /bin/bash \ |
70 | | - -u 1000 \ |
71 | | - -G git \ |
72 | | - git && \ |
73 | | - echo "git:*" | chpasswd -e |
74 | | - |
75 | | -ENV USER git |
76 | | -ENV GITEA_CUSTOM /data/gitea |
77 | | - |
78 | | -VOLUME ["/data"] |
79 | | - |
80 | | -ENTRYPOINT ["/usr/bin/entrypoint"] |
81 | | -CMD ["/bin/s6-svscan", "/etc/s6"] |
82 | | - |
83 | | -COPY --from=build-env /tmp/local / |
84 | | -COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea |
85 | | -COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini |
86 | | -COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh |
| 11 | +#Build deps |
| 12 | +# RUN apk --no-cache add build-base git nodejs npm |
| 13 | +RUN apt-get update |
| 14 | +RUN apt-get --yes install --no-install-recommends git ca-certificates curl gnupg && apt-get --yes clean |
| 15 | +# nodejs in bullseye is too old |
| 16 | +# Use the version from the alpine version used by Gitea in their dockerfile |
| 17 | +RUN \ |
| 18 | + mkdir -p /etc/apt/keyrings && \ |
| 19 | + (curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg) && \ |
| 20 | + (echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list) && \ |
| 21 | + apt-get update && \ |
| 22 | + apt-get --yes install --no-install-recommends nodejs && \ |
| 23 | + apt-get --yes clean |
| 24 | + |
| 25 | +#Setup repo |
| 26 | +# <- COPY go.mod and go.sum files |
| 27 | +RUN mkdir /deps |
| 28 | +WORKDIR /deps |
| 29 | +COPY go.mod . |
| 30 | +COPY go.sum . |
| 31 | +RUN go mod download -x |
| 32 | + |
| 33 | +COPY package-lock.json . |
| 34 | +COPY package.json . |
| 35 | +RUN npm install --global |
| 36 | + |
| 37 | + |
| 38 | +WORKDIR ${GOPATH}/src/gitea |
| 39 | + |
| 40 | +RUN git config --global --add safe.directory ${GOPATH}/src/gitea |
0 commit comments