mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
build: 清理apt源并配置Composer镜像加速依赖安装
清理现有apt源文件避免冲突,统一使用USTC镜像源 添加Composer镜像配置使用阿里云源,提前安装依赖优化构建过程
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -1,6 +1,7 @@
|
||||
FROM php:8.2-fpm-bookworm
|
||||
|
||||
RUN echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list \
|
||||
RUN rm -rf /etc/apt/sources.list.d/* \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware" > /etc/apt/sources.list \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware" >> /etc/apt/sources.list \
|
||||
&& echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware" >> /etc/apt/sources.list
|
||||
|
||||
@@ -33,9 +34,22 @@ RUN rm /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# 安装 Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
# 复制 composer.json 并安装依赖
|
||||
COPY composer.json /var/www/html/
|
||||
# 配置 composer 镜像源并安装依赖
|
||||
RUN composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/ \
|
||||
&& composer install --no-dev --no-interaction --no-scripts --no-autoloader
|
||||
|
||||
# 将当前目录下的文件拷贝到工作目录
|
||||
COPY . /var/www/html
|
||||
|
||||
# 生成自动加载文件
|
||||
RUN composer dump-autoload --optimize --no-dev --classmap-authoritative
|
||||
|
||||
# 内部安装compsoer并安装依赖,如果不需要可以注释掉
|
||||
# RUN install-php-extensions @composer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user