Discuz

1.打包Docker

  • 下载最新源码Discuz!官方网站 - 开放、连接、共赢

  • 解压Discuz_X3.5_SC_UTF8_20240520.zip

  • 进入upload目录

  • 编写Dockerfile内容如下:

    • amd版本:
    FROM php:8.1-apache
    RUN docker-php-ext-install mysqli && docker-php-ext-install pdo_mysql
    WORKDIR  /var/www/html
    
    COPY . .
    
    
    # Add core PHP extensions, see
    # https://github.com/docker-library/docs/tree/master/php#php-core-extensions
    # This example adds the apt packages for the 'gd' extension's dependencies and then
    # installs the 'gd' extension. For additional tips on running apt-get:
    # https://docs.docker.com/go/dockerfile-aptget-best-practices/
    # RUN apt-get update && apt-get install -y \
    #     libfreetype-dev \
    #     libjpeg62-turbo-dev \
    #     libpng-dev \
    # && rm -rf /var/lib/apt/lists/* \
    #     && docker-php-ext-configure gd --with-freetype --with-jpeg \
    #     && docker-php-ext-install -j$(nproc) gd
    #
    # Add PECL extensions, see
    # https://github.com/docker-library/docs/tree/master/php#pecl-extensions
    # This example adds the 'redis' and 'xdebug' extensions.
    # RUN pecl install redis-5.3.7 \
    #    && pecl install xdebug-3.2.1 \
    #    && docker-php-ext-enable redis xdebug
    
    
    RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && chmod -R a+w ./config && chmod -R a+w ./data && chmod -R a+w ./uc_server   && chmod -R a+w ./uc_client 
    
    
    USER www-data
    
    
    • arm64版本:
FROM --platform=linux/arm64 php:8.1-apache
RUN docker-php-ext-install mysqli && docker-php-ext-install pdo_mysql
WORKDIR  /var/www/html
COPY . .
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && chmod -R a+w ./config && chmod -R a+w ./data && chmod -R a+w ./uc_server   && chmod -R a+w ./uc_client 
USER www-data
  • 打包:

dockr build -t discuz:x3.5 .

  • 运行:docker run -d -p 80:80 discuz:x3.5

  • 访问:http://IP,根据安装向导配置数据库后即可访问

更多推荐