Files
devstar/Dockerfile.rootless

100 lines
3.4 KiB
Docker
Raw Normal View History

2024-09-03 13:01:06 +08:00
ARG DOCKER_REGISTRY_ADDRESS="devstar.cn"
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
ARG DOCKER_REGISTRY_USERNAME="devstar"
ARG DEV_CONTAINER="gitea-dev-container:v1.0"
ARG RUNTIME_CONTAINER="gitea-runtime-container:v1.1"
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
###########################################################
# stage1: Building Stage
FROM ${DOCKER_REGISTRY_ADDRESS}/${DOCKER_REGISTRY_USERNAME}/${DEV_CONTAINER} AS build-env
# 设置 Go 代理
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
ARG GOPROXY="https://goproxy.cn"
ENV GOPROXY=${GOPROXY:-direct}
# 注:对于 NPM 代理/镜像, 参考仓库 `/.npmrc` 文件下的 `registry` 变量,推荐使用淘宝镜像,即 `registry=https://registry.npmmirror.com/`
# 允许使用自动版本
ENV GOTOOLCHAIN=auto
ARG GITEA_VERSION
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
# TODO: 适配 https://devstar.cn
# 增加 MySQL, Redis - 测试通过后期上线改成 MySQL HA, Redis HA
ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS="bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS
# Setup repo
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
COPY . /go/src/code.gitea.io/gitea
WORKDIR /go/src/code.gitea.io/gitea
2024-08-13 19:23:05 +08:00
# Bypass Root User Check in dev container (otherwise, 'make test' phase is to be failed):
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
# modules/setting/setting.go::loadRunModeFrom:"Gitea is not supposed to be run as root."
ENV GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT=1
# Checkout version if set
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
RUN if [ -n "${GITEA_VERSION}" ]; then \
git checkout "${GITEA_VERSION}"; \
fi \
&& make clean-all test build \
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
&& echo "-------------------" \
&& echo " BUILD SUCCESS" \
&& echo "-------------------"
# Begin env-to-ini build
RUN go build contrib/environment-to-ini/environment-to-ini.go
# Copy local files
COPY docker/rootless /tmp/local
# Set permissions
RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
/tmp/local/usr/local/bin/docker-setup.sh \
/tmp/local/usr/local/bin/gitea \
/go/src/code.gitea.io/gitea/gitea \
/go/src/code.gitea.io/gitea/environment-to-ini
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
###########################################################
# stage2: Prepare Gitea runtime environment
FROM ${DOCKER_REGISTRY_ADDRESS}/${DOCKER_REGISTRY_USERNAME}/${RUNTIME_CONTAINER} AS runtime-env
Squashed commit of the following: commit 2ed4e3e307f03b7a7a0dd626cfcf7e9b000e2ebe Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 11:48:00 2024 +0000 resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA commit 690157811bf516d8ca2c684f9aec50195ee2707d Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:21:39 2024 +0000 fix: checkout the corresponding branch(master or dev) commit 046ff63e42ab4ab3e817350c530165d6ea5d0309 Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 10:01:24 2024 +0000 test new CI pipeline workflow in the org repo, with a bunch of ENV vars commit faf7f51d859a88932c53f2f66ede66817c3c1fcb Author: 戴明辰 <daimingchen@mail.ustc.edu.cn> Date: Thu Jul 25 07:59:31 2024 +0000 !1 DevStar Studio 界面原型 + CI流水线测试通过 * finalize this PoC repo, and migrate to the main repo (as a dev branch) * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go * bugFix: CAPTCHA needs manual reloading * Updated UI * Changed logo and favicon * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and … * Added Unit Test in CI workflow, and removed redundant tests in dev container * Compliance with open source licensing requirements * Fix workflow: only exec 'docker rm' if there are dangling volumes * Removed Magic values about: Docker registry(URL, username), k8s(nanesp… * fix mistakes: git checkout branch should be master rather than the sta… * Updated UI layouts and build scripts * Updated copyright info and ICP License ID at page footer * Updated ICP License ID at page footer * Updated code ownership: web footer, logo and favicon * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
EXPOSE 2222 3000
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 --from=build-env /tmp/local /
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/devcontainer_init.sh /app/gitea/devcontainer_init.sh
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/devcontainer_restart.sh /app/gitea/devcontainer_restart.sh
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
# 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 []