Fix Docker build missing websocket support

The Docker image first builds a static curl-impersonate, then builds
libcurl-impersonate separately. However, the second build overrode the
binary created in the first one, and was configured without websocket
support in addition. This commit fixes both:
* The second build does not override the first, static build.
* The second build is configured with websockets.
This commit is contained in:
lwthiker
2024-02-27 20:13:34 +02:00
parent 1f2bbd6565
commit d90993cf06
5 changed files with 25 additions and 10 deletions
+5 -2
View File
@@ -109,7 +109,8 @@ RUN mkdir out && \
RUN ./out/curl-impersonate -V | grep -q zlib && \
./out/curl-impersonate -V | grep -q brotli && \
./out/curl-impersonate -V | grep -q nghttp2 && \
./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL
./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL && \
./out/curl-impersonate -V | grep -q -e wss
# Verify that the resulting 'curl' is really statically compiled
RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto)
@@ -119,6 +120,7 @@ RUN rm -Rf /build/install
# Re-compile libcurl dynamically
RUN cd ${CURL_VERSION} && \
./configure --prefix=/build/install \
--enable-websockets \
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
--with-openssl=/build/boringssl/build \
@@ -150,7 +152,8 @@ FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy curl-impersonate from the builder image
COPY --from=builder /build/install /usr/local
COPY --from=builder /build/out/curl-impersonate* /usr/local/bin
COPY --from=builder /build/out/libcurl-impersonate* /usr/local/lib
# Update the loader's cache
RUN ldconfig
# Copy to /build/out as well for backward compatibility with previous versions.