mirror of https://github.com/go-gitea/gitea
Merge 5dbe14afcf
into 89e39872ff
This commit is contained in:
commit
4320f19e76
|
@ -9,6 +9,11 @@ ARG TAGS="sqlite sqlite_unlock_notify"
|
|||
ENV TAGS "bindata timetzdata $TAGS"
|
||||
ARG CGO_EXTRA_CFLAGS
|
||||
|
||||
ARG GIT_UID
|
||||
ARG GIT_GID
|
||||
ENV GIT_GID_ENV=${GIT_GID}
|
||||
ENV GIT_UID_ENV=${GIT_UID}
|
||||
|
||||
# Build deps
|
||||
RUN apk --no-cache add \
|
||||
build-base \
|
||||
|
@ -61,13 +66,13 @@ RUN apk --no-cache add \
|
|||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
RUN addgroup \
|
||||
-S -g 1000 \
|
||||
-S -g ${GIT_GID_ENV:-1010} \
|
||||
git && \
|
||||
adduser \
|
||||
-S -H -D \
|
||||
-h /data/git \
|
||||
-s /bin/bash \
|
||||
-u 1000 \
|
||||
-u ${GIT_UID_ENV:-1010} \
|
||||
-G git \
|
||||
git && \
|
||||
echo "git:*" | chpasswd -e
|
||||
|
|
|
@ -9,6 +9,11 @@ ARG TAGS="sqlite sqlite_unlock_notify"
|
|||
ENV TAGS "bindata timetzdata $TAGS"
|
||||
ARG CGO_EXTRA_CFLAGS
|
||||
|
||||
ARG GIT_UID
|
||||
ARG GIT_GID
|
||||
ENV GIT_GID_ENV=${GIT_GID}
|
||||
ENV GIT_UID_ENV=${GIT_UID}
|
||||
|
||||
#Build deps
|
||||
RUN apk --no-cache add \
|
||||
build-base \
|
||||
|
@ -55,13 +60,13 @@ RUN apk --no-cache add \
|
|||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
RUN addgroup \
|
||||
-S -g 1000 \
|
||||
-S -g ${GIT_GID_ENV:-1010} \
|
||||
git && \
|
||||
adduser \
|
||||
-S -H -D \
|
||||
-h /var/lib/gitea/git \
|
||||
-s /bin/bash \
|
||||
-u 1000 \
|
||||
-u ${GIT_UID_ENV:-1010} \
|
||||
-G git \
|
||||
git
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ services:
|
|||
- "2222:2222"
|
||||
```
|
||||
|
||||
Note that the volume should be owned by the user/group with the UID/GID specified in the config file. By default Gitea in docker will use uid:1000 gid:1000. If needed you can set ownership on those folders with the command:
|
||||
Note that the volume should be owned by the user/group with the UID/GID specified in the config file. By default Gitea in docker will use uid:1010 gid:1010. If needed you can set ownership on those folders with the command:
|
||||
|
||||
```sh
|
||||
sudo chown 1000:1000 config/ data/
|
||||
sudo chown 1010:1010 config/ data/
|
||||
```
|
||||
|
||||
> If you don't give the volume correct permissions, the container may not start.
|
||||
|
|
|
@ -54,10 +54,10 @@ services:
|
|||
- "2222:2222"
|
||||
```
|
||||
|
||||
请注意,卷应由在配置文件中指定的UID/GID的用户/组所有。默认情况下,Docker中的Gitea将使用uid:1000 gid:1000。如果需要,您可以使用以下命令设置这些文件夹的所有权:
|
||||
请注意,卷应由在配置文件中指定的UID/GID的用户/组所有。默认情况下,Docker中的Gitea将使用uid:1010 gid:1010。如果需要,您可以使用以下命令设置这些文件夹的所有权:
|
||||
|
||||
```sh
|
||||
sudo chown 1000:1000 config/ data/
|
||||
sudo chown 1010:1010 config/ data/
|
||||
```
|
||||
|
||||
> 如果未为卷设置正确的权限,容器可能无法启动。
|
||||
|
|
|
@ -46,8 +46,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
|
@ -78,8 +78,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
|
@ -113,8 +113,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
+ - GITEA__database__DB_TYPE=mysql
|
||||
+ - GITEA__database__HOST=db:3306
|
||||
+ - GITEA__database__NAME=gitea
|
||||
|
@ -164,8 +164,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
+ - GITEA__database__DB_TYPE=postgres
|
||||
+ - GITEA__database__HOST=db:5432
|
||||
+ - GITEA__database__NAME=gitea
|
||||
|
@ -256,8 +256,8 @@ documented above, please note that `db` must be used as the database hostname.
|
|||
## Configure the user inside Gitea using environment variables
|
||||
|
||||
- `USER`: **git**: The username of the user that runs Gitea within the container.
|
||||
- `USER_UID`: **1000**: The UID (Unix user ID) of the user that runs Gitea within the container. Match this to the UID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
|
||||
- `USER_GID`: **1000**: The GID (Unix group ID) of the user that runs Gitea within the container. Match this to the GID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
|
||||
- `USER_UID`: **1010**: The UID (Unix user ID) of the user that runs Gitea within the container. Match this to the UID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
|
||||
- `USER_GID`: **1010**: The GID (Unix group ID) of the user that runs Gitea within the container. Match this to the GID of the owner of the `/data` volume if using host volumes (this is not necessary with named volumes).
|
||||
|
||||
## Customization
|
||||
|
||||
|
@ -364,8 +364,8 @@ In this option, the idea is that the host simply uses the `authorized_keys` that
|
|||
|
||||
```yaml
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
```
|
||||
|
||||
- Mount `/home/git/.ssh` of the host into the container. This ensures that the `authorized_keys` file is shared between the host `git` user and the container `git` user otherwise the SSH authentication cannot work inside the container.
|
||||
|
|
|
@ -37,8 +37,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
|
@ -67,8 +67,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
|
@ -101,8 +101,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
+ - GITEA__database__DB_TYPE=mysql
|
||||
+ - GITEA__database__HOST=db:3306
|
||||
+ - GITEA__database__NAME=gitea
|
||||
|
@ -151,8 +151,8 @@ services:
|
|||
image: gitea/gitea:@version@
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
+ - GITEA__database__DB_TYPE=postgres
|
||||
+ - GITEA__database__HOST=db:5432
|
||||
+ - GITEA__database__NAME=gitea
|
||||
|
@ -255,8 +255,8 @@ MySQL 或 PostgreSQL 容器将需要分别创建。
|
|||
- `SECRET_KEY`:**""** :全局密钥。这应该更改。如果它具有一个值并且 `INSTALL_LOCK` 为空,则 `INSTALL_LOCK` 将自动设置为 `true`。
|
||||
- `DISABLE_REGISTRATION`:**false**:禁用注册,之后只有管理员才能为用户创建帐户。
|
||||
- `REQUIRE_SIGNIN_VIEW`:**false**:启用此选项可强制用户登录以查看任何页面。
|
||||
- `USER_UID`:**1000**:在容器内运行 Gitea 的用户的 UID(Unix 用户 ID)。如果使用主机卷,则将其与 `/data` 卷的所有者的 UID 匹配(对于命名卷,则不需要这样做)。
|
||||
- `USER_GID`:**1000**:在容器内运行 Gitea 的用户的 GID(Unix 组 ID)。如果使用主机卷,则将其与 `/data` 卷的所有者的 GID 匹配(对于命名卷,则不需要这样做)。
|
||||
- `USER_UID`:**1010**:在容器内运行 Gitea 的用户的 UID(Unix 用户 ID)。如果使用主机卷,则将其与 `/data` 卷的所有者的 UID 匹配(对于命名卷,则不需要这样做)。
|
||||
- `USER_GID`:**1010**:在容器内运行 Gitea 的用户的 GID(Unix 组 ID)。如果使用主机卷,则将其与 `/data` 卷的所有者的 GID 匹配(对于命名卷,则不需要这样做)。
|
||||
|
||||
## 自定义
|
||||
|
||||
|
@ -319,8 +319,8 @@ services:
|
|||
|
||||
```bash
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- USER_UID=1010
|
||||
- USER_GID=1010
|
||||
```
|
||||
|
||||
接下来将主机的 `/home/git/.ssh` 装入容器。否则,SSH 身份验证将无法在容器内运行。
|
||||
|
|
Loading…
Reference in New Issue