从git克隆的构建代码在dockerfile中失败

问题描述 投票:0回答:1

我想为Quassel IRC Core创建一个Dockerfile。我想从源代码构建它,所以我克隆了存储库并希望进行编译,但是出现此有线错误。

CMake Error: The source directory "/tmp/quassel-src" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

这是我的Dockerfile:

FROM ubuntu:18.04

MAINTAINER KeinNerd <[email protected]>

# install required packages for the build process
RUN \
 apt-get update && apt-get install -y \
  cmake \
  make \
  build-essential \
  libboost-all-dev \
  git-core \
  icu-devtools \
  libicu60 \
  libssl-dev \
  qtbase5-dev \
  libqt5dbus5 \
  qtbase5-dev-tools \
  qtscript5-dev \
  libqt5sql5-psql \
  libqt5sql5-sqlite \
  libqca-qt5-2-dev

# clone quassel-core source
RUN \
mkdir -p /tmp/quassel-src \
git clone https://github.com/quassel/quassel.git /tmp/quassel-src/ \
mkdir -p /tmp/quassel-src/build

# build the quassel-core
RUN \
cd /tmp/quassel-src/build && \ 
cmake \
        -DCMAKE_BUILD_TYPE="Release" \
        -DCMAKE_INSTALL_PREFIX=/usr/local/ \
        -DUSE_QT5=ON \
        -DWANT_CORE=ON \
        -DWANT_MONO=OFF \
        -DWANT_QTCLIENT=OFF \
        -DWITH_KDE=OFF \
        -DWITH_CRYPT=ON \
        /tmp/quassel-src && \
make && \
make install

# set environment variables
ENV HOME /config

# copy startfile
COPY start.sh /start.sh

# ports and volumes
VOLUME /config
EXPOSE 4242 4242

# start quassel-core
ENTRYPOINT ["/start.sh"]

当我在测试机上的终端中运行代码时,它将编译并安装而没有错误。但是,如果我构建docker映像,则会收到错误..但其代码相同。

cd /tmp/quassel-src/build && \ 
cmake \
        -DCMAKE_BUILD_TYPE="Release" \
        -DCMAKE_INSTALL_PREFIX=/usr/local/ \
        -DUSE_QT5=ON \
        -DWANT_CORE=ON \
        -DWANT_MONO=OFF \
        -DWANT_QTCLIENT=OFF \
        -DWITH_KDE=OFF \
        -DWITH_CRYPT=ON \
        /tmp/quassel-src && \
make && \
make install

我希望有人可以帮助我。

docker makefile cmake
1个回答
0
投票

[尝试添加:WORKDIR / tmp / quassel-src / build,而不是RUN cd / tmp / quassel-src / build,然后将COPY start.sh /start.sh修改为COPY start.sh ../start.sh (也许此脚本需要在该目录中)

cd的效果仅对当前RUN命令有效。下次运行将从当前的WORKDIR开始。

也尝试添加:VOLUME / config,然后将HOME设置为ENV。

© www.soinside.com 2019 - 2024. All rights reserved.