簡體   English   中英

在 jenkins 容器內安裝 php 和 composer

[英]install php and composer inside jenkins container

我正在嘗試創建一個 Jenkins 管道,該管道具有“測試”階段,需要 PHP 和 Composer 才能使用 PHPUnit 運行測試。

如何在 Jenkins Docker 容器內安裝 PHP(最好是 7.4 版)和 Composer?

這就是我在容器的 Dockerfile 中嘗試的方法:

FROM jenkins/jenkins

USER root

# install PHP and Composer
RUN apt-get install -y php php-mbstring php-xml php-bcmath && \
    apt-get install -y composer
    
USER jenkins

當我構建圖像時,出現此錯誤:

Step 3/4 : RUN apt-get install -y php php-mbstring php-xml php-bcmath php-fpm &&     apt-get install -y composer && apt-get install -y vim
 ---> Running in 0b20c56bd720
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php
E: Unable to locate package php-mbstring
E: Unable to locate package php-xml
E: Unable to locate package php-bcmath
E: Unable to locate package php-fpm

您在install之前錯過了apt-get update

sudo apt-get update 命令用於從所有配置的源下載 package 信息

看到這個

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM