curl - Is there a way to compile cURL and all deps to a specific directory?
问题描述
I'm trying to compile cURL for busybox on multiple platforms, but I need to copy it to another Docker container once it's built. I previously had this working with this:
RUN wget -q https://curl.haxx.se/download/curl-7.63.0.tar.gz && \
tar xzf curl-7.63.0.tar.gz && \
cd curl-7.63.0 && \
LIBS="-ldl" ./configure --disable-shared && \
make && \
make install
However, for some reason, perhaps a mistake I've made, it is no longer compiling statically and requires libs like libcurl, libz etc. Previously I had it working only requiring libssl/libcrypto etc.
So my question is really, is there a way to compile cURL and all of it's deps and shared libraries, to a specific directory so that I can copy that rather than trying to build a statically linked binary to copy?
Thanks
解决方案
对于它的价值,这是可能的--prefix=/build
论点。
用于构建(非常精简)cURL 的完整 Dockerfile 是:
FROM buildpack-deps:stretch-scm
ARG VERSION=7.63.0
RUN apt-get update && \
apt-get install -y --no-install-recommends \
g++ gcc libc6-dev make pkg-config
RUN apt-get install -y libssl-dev
RUN wget -q https://curl.haxx.se/download/curl-${VERSION}.tar.gz && \
tar xzf curl-${VERSION}.tar.gz
WORKDIR curl-${VERSION}
RUN ./configure --prefix=/build \
--without-zlib \
--disable-cookies \
--disable-verbose \
--disable-versioned-symbols \
--disable-shared --enable-static \
--disable-ftps --disable-gopher \
--disable-imap --disable-imaps \
--disable-ldap --disable-ldaps \
--disable-pop3 --disable-pop3s \
--disable-rtmp --disable-rtsp \
--disable-dict --disable-file \
--disable-ftp --disable-sftp \
--disable-smb --disable-smbs \
--disable-smtp --disable-smtps \
--disable-telnet --disable-tftp && \
make && \
make install
然后,您可以像这样提取它:
ARG CURL_IMAGE
FROM ${CURL_IMAGE} AS base
FROM busybox
ARG LIB_LOCATION
COPY --from=base /build/bin/curl /usr/sbin/curl
COPY --from=base ${LIB_LOCATION}/libssl.so.1.1 ${LIB_LOCATION}/libssl.so.1.1
COPY --from=base ${LIB_LOCATION}/libcrypto.so.1.1 ${LIB_LOCATION}/libcrypto.so.1.1
这很可能在将来只对我有用,但是你去吧。
编辑:LIB_LOCATION 是 amd64、arm64 和 arm 的以下之一。
/usr/lib/x86_64-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/aarch64-linux-gnu
推荐阅读
- python-3.x - 如何在 tkinter 中创建多个按钮,当悬停在它们上时更改背景图像?
- python - 如何使用 event.x 和 event.y 作为我在每个地方都使用的变量
- python - 如何执行我的函数到这样的字符串:`string.func()`
- postgresql - 如何编辑导致唯一性违规的记录并将更改回显到子表?
- node.js - Laravel Echo、Socket io、Redis和Vue的基本理解
- android - Android studio Flutter 热重载按钮不起作用
- generics - 即使提供了类型注释也需要
- java - 为什么我不能设置来自不同包中类似类的对象列表
- reactjs - 传递大量道具来反应孩子
- python - 之前返回“True”的hasattr(),代码转换成cython后返回“False”