forgejo/Dockerfile.rootless

77 lines
2 KiB
Docker
Raw Normal View History

#Build stage
FROM docker.io/library/golang:1.21-alpine3.18 AS build-env
ARG GOPROXY
ENV GOPROXY ${GOPROXY:-direct}
ARG GITEA_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS "bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS
#Build deps
RUN apk --no-cache add build-base git nodejs npm
#Setup repo
COPY . ${GOPATH}/src/code.gitea.io/gitea
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
#Checkout version if set
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
&& make clean-all build
# Begin env-to-ini build
RUN go build contrib/environment-to-ini/environment-to-ini.go
FROM docker.io/library/alpine:3.18
[CI] implementation: forgejo container images (cherry picked from commit dd1971d4e60f37fb76daeb6cef8b1defcc957a34) (cherry picked from commit 3981dbaf8c0dd74b0e82a7afc36809998ac775a2) (cherry picked from commit 8dff3cc2d1a51980439e9ca8f1cad592403c558e) (cherry picked from commit e7673e5d2237733e4e17b9386c4bb25bb88fe2e2) (cherry picked from commit 326174064ba6dbd379ea82e9643e23fe684ad96f) (cherry picked from commit eb769dbde4fb0d7a8a4bd74b6bcdf1f1f180f840) (cherry picked from commit 335829ade20a187c7fd423909231d198a59545bd) (cherry picked from commit 5e8e4f549d2224a00387764e93fdbde34e324c3d) Conflicts: Dockerfile Dockerfile.rootless (cherry picked from commit b777fc91d0ba5b1a061bd9cc57c4818a3357b42a) (cherry picked from commit 02cda642ec7ce2b69de7f0ff4fb4f0d70941f54e) (cherry picked from commit 96ef93f3bc1b618831f04e1ae5d5c7c74e2ed36c) (cherry picked from commit aa424551f24364dd43d9b7739b723bb1d914eeaf) Conflicts: Dockerfile Dockerfile.rootless (cherry picked from commit e54fa86e4904047e5670e68a9dd89e76530564a4) (cherry picked from commit 043fa6d6649272f14a65ee2c9cac15b090e66bc9) (cherry picked from commit 805b16248015e8d7ab8c4f514969cff333d432c8) (cherry picked from commit 86bf362a3c8386cc4530c0c4cba46097ed20d8af) (cherry picked from commit 13e0007959fb5e2496b3bbec916036bd2a05a558) (cherry picked from commit 00ff6f7cb3c54ae3a8ed2069b0dd0dddd98e7e6e) (cherry picked from commit 95c7d8e883da495facfbac39db55b5b710ea25a7) (cherry picked from commit fb033d2bb613c34b7f61c2bad14136f8f110081e) (cherry picked from commit 1147910a552db9fdf7f4ef0a35e9b1d2405b0e69) (cherry picked from commit 6590b6e99c9c31389f6b948976fba3fea8da7eb7) (cherry picked from commit 78938113e4908df1d1e5181c1aa7605e7bc5747d) (cherry picked from commit 57338224f172e30a72f03f565aa47876e1213e77) (cherry picked from commit 4266cbcdd415de2deaea8620fe9b7b53866171ba) (cherry picked from commit bdc766a5a2304fc1826649ac747a2724fed6e7ab) (cherry picked from commit 6fb9ad85046fedf381a948906841098eb4ac010f) (cherry picked from commit c4e6383240c4188fd65bf751aaf8f38466fe60e7) (cherry picked from commit 490fa55b3abab2450073bc2358893687a06305cc)
2022-11-25 09:11:23 +00:00
LABEL maintainer="contact@forgejo.org"
EXPOSE 2222 3000
RUN apk --no-cache add \
bash \
ca-certificates \
dumb-init \
gettext \
git \
curl \
gnupg
RUN addgroup \
-S -g 1000 \
git && \
adduser \
-S -H -D \
-h /var/lib/gitea/git \
-s /bin/bash \
-u 1000 \
-G git \
git
RUN mkdir -p /var/lib/gitea /etc/gitea
RUN chown git:git /var/lib/gitea /etc/gitea
COPY docker/rootless /
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
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
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh
#git:git
USER 1000:1000
ENV GITEA_WORK_DIR /var/lib/gitea
ENV GITEA_CUSTOM /var/lib/gitea/custom
ENV GITEA_TEMP /tmp/gitea
ENV TMPDIR /tmp/gitea
#TODO add to docs the ability to define the ini to load (useful to test and revert a config)
ENV GITEA_APP_INI /etc/gitea/app.ini
ENV HOME "/var/lib/gitea/git"
VOLUME ["/var/lib/gitea", "/etc/gitea"]
WORKDIR /var/lib/gitea
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
CMD []