3

我正在尝试为 CiviCRM 创建一个可靠的 Docker 映像,因为 Docker 集线器中没有与 README 或可读的 Dockerfile 构建代码捆绑在一起的任何映像。唯一有据可查的图像不符合标准 Docker 约定。这是项目:https ://github.com/djcf/civibuild-docker

因此,我编写了这个 Dockerfile,它使用 CiviCRM buildkit 安装标准安装。唯一的问题是它不起作用。大约一周前我让它工作了,但现在我没有做任何事情来构建它是成功的。(当我第一次尝试在 Docker 中安装 Civi 时,我什至尝试重新运行当前的 buildkit 提交 - https://raw.githubusercontent.com/civicrm/civicrm-buildkit/666d74d1e862957986e3b91c3206e3717d7058a1/bin/civi-download-tools - - 没运气。

Dockerfile 非常简单。

FROM colstrom/fish:ubuntu
# (this adds the Friendly Interactive Shell to Ubuntu 14.04

ENV CIVITYPE drupal-clean
ENV CMS_ROOT /buildkit/build
ENV SITE_NAME "Civi"
ENV SITE_ID "civi"
ENV TMPDIR /buildkit/tmp

RUN apt-get update; apt-get install -y curl links ssmtp
RUN curl -Ls https://civicrm.org/get-buildkit.sh | bash -s -- --full --dir /buildkit

COPY dbconf.sh /buildkit
COPY postinstall.sh /buildkit

# This is the problem part -- 
# but it makes three different errors depending on what environment its run.
RUN /buildkit/bin/civibuild create civicrm --type drupal-clean --url http://localhost:80 --admin-pass 123

RUN apt-get install -y runit
RUN /buildkit/postinstall.sh; apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME /buildkit/build
VOLUME /var/lib/mysql

EXPOSE 80

ENTRYPOINT ["/usr/sbin/docker-entrypoint.sh"]

dbconf.sh 预安装脚本确保 MySQL 正在运行,并复制脚本所需的一些配置。特别是它确保 amp 可以与 MySQL 通信,该 amp 具有与 MySQL 通信的正确设置,并且该 bower 将接受由 root 用户运行。

现在这是奇怪的事情。

当我运行构建脚本(docker build -t civibuild)时,构建在buildkit 构建命令开始时失败: 第 15 步:运行 /buildkit/dbconf.sh ;/buildkit/bin/civibuild 创建 civicrm --type drupal-clean --url http://localhost:80 --admin-pass 123

---> Running in 3f9999dbdb12
* Starting MySQL database server mysqld
 ...done.
* Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly.
Finished running pr-configuration, will now install CiviCRM using buildkit buildscript.
ln: failed to create symbolic link 'bower': File exists
The command '/bin/sh -c /buildkit/dbconf.sh ; /buildkit    /bin/civibuild create civicrm --type drupal-clean --url    http://localhost:80 --admin-pass 123' returned a non-zero code: 1

因此,我尝试在香草 Ubuntu 14.04 Docker 映像中手动运行完全相同的步骤(docker run --it ubuntu:14.04 /bin/bash)。这一次,Civi 构建完成了大约一半,然后出现错误:

CiviCRM was isntalled successfully                 [ok]
/buildkit/app/config/drupal-clean/install.sh: line 42: 17650    
Segmentation fault      (core dumped) drush -y dis overlay

然后我尝试在 Vagrant 图像中手动运行完全相同的步骤。这次脚本成功完成。

4

1 回答 1

1

该解决方案最终被追溯到无效的 docker build 缓存。在之前的运行中,bower 安装失败,缓存中的符号链接错误。

解决方案:使用 docker build --no-cache 运行。

于 2016-02-02T19:02:07.587 回答