docker-compose部署Gitea

2022-10-27 15:16:10 浏览数 (1)

代码语言:javascript复制
vim /data/docker-compose.yml

version: "3.7"

services:
  gitea:
    image: gitea/gitea:1.15.6
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA_database_DB_TYPE=mysql
      - GITEA_database_HOST=mysql
      - GITEA_database_NAME=gitea
      - GITEA_database_USER=gitea
      - GITEA_database_PASSWD=123456
    restart: always

    volumes:
      - type: bind
        source: /data/gitea
        target: /data

      - type: bind
        source: /etc/timezone
        target: /etc/timezone:ro

      - type: bind
        source: /etc/localtime
        target: /etc/localtime:ro

    ports:
      - "8888:22"
      - "3000:3000"
      - "2222:2222"
    depends_on:
      - mysql
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:3000" ]
      interval: 1m
      timeout: 10s
      retries: 3
      start_period: 10s

  mysql:
    container_name: mysql
    image: mysql:5.7.36
    restart: always
    ports:
      - "3306"
      - "3306:3306"
    environment:
      TZ: Asia/Shanghai
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_DATABASE: gitea
      MYSQL_USER: gitea
      MYSQL_PASSWORD: 123456
    command: ['mysqld', '--character-set-server=utf8mb4']
    volumes:
      - /data/mysql/data:/var/lib/mysql
      - /data/mysql/conf/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf

docker-compose up -d


我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1melm7zbxp9z9

0 人点赞