Gitea: linux系统docker安装使用gitea,实现git-server服务端

Gitea: linux系统docker安装使用gitea,实现git-server服务端

2023-03-28

本文记录了在linux系统上,使用docker-compose创建gitea容器,实现git服务端的搭建。

1、创建文件夹

mkdir gitea3000
cd gitea3000

2、编辑docker-compose.yml文件

vi docker-compose.yml  # yml文件在下边
# docker-comopose.yml
version: "3"
networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.17.2
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "3222:22"

3. 运行docker-compse up

# 运行docker-compse up 启动容器
docker-compose up

4. docker的重启指令

# docker常用的几个指令
docker restart gitea
docker stop gitea
docker start gitea

5. docker进入容器的指令

# 进入运行中的容器 名称或者容器ID
docker exec -i -t gitea bash
docker exec -i -t 2f12d291d8f7 bash

6. 关于app.ini 配置文件

容器运行起来后,在网页基础配置后,会生成app.ini。
可以通过修改这个配置文件,更改gitea的配置。

# app.ini 参考
#[root@VM-24-15-centos conf]# cat app.ini 
APP_NAME = 空间科技git存储服务
RUN_MODE = prod
RUN_USER = git

[repository]
ROOT = /data/git/repositories

[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
APP_DATA_PATH    = /data/gitea
DOMAIN           = goldchen.space
SSH_DOMAIN       = goldchen.space
HTTP_PORT        = 3000
ROOT_URL         = https://goldchen.space/
DISABLE_SSH      = true
SSH_PORT         = 22
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = true
LFS_JWT_SECRET   = 0AAqNU1MG-3yR0d0sImSHADPqMUciQKH4AMUGzsCv1g
OFFLINE_MODE     = false
LANDING_PAGE     = explore

[database]
PATH     = /data/gitea/gitea.db
DB_TYPE  = sqlite3
HOST     = localhost:3306
NAME     = gitea
USER     = root
PASSWD   = 
LOG_SQL  = false
SCHEMA   = 
SSL_MODE = disable
CHARSET  = utf8

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER        = file

[picture]
AVATAR_UPLOAD_PATH            = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars
DISABLE_GRAVATAR              = false
ENABLE_FEDERATED_AVATAR       = true

[attachment]
PATH = /data/gitea/attachments

[log]
MODE      = console
LEVEL     = info
ROUTER    = console
ROOT_PATH = /data/gitea/log

[security]
INSTALL_LOCK                  = true
SECRET_KEY                    = 
REVERSE_PROXY_LIMIT           = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
INTERNAL_TOKEN                = eyhhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NjUzMjcwOTh9.pDWamFqXJ2GdJ8j4vO1AaSmtkBlq7K-Nz0FEZOTFP68
PASSWORD_HASH_ALGO            = pbkdf2

[service]
DISABLE_REGISTRATION              = true
REQUIRE_SIGNIN_VIEW               = true
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = false
ENABLE_CAPTCHA                    = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = noreply.localhost

[lfs]
PATH = /data/git/lfs

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

[other]
SHOW_FOOTER_BRANDING = false
SHOW_FOOTER_VERSION = false
SHOW_FOOTER_TEMPLATE_LOAD_TIME = true

7. 运行完成,可以愉快的使用了

你可能感兴趣的:(开发软件技巧,docker,git,linux)