Skip to content

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox

Install nss in final alpine image

lwthiker4ea8f859eb24
diff --git a/Dockerfile.template b/Dockerfile.template
index 9516c30..11a6916 100644
--- a/Dockerfile.template
+++ b/Dockerfile.template
@@ -44,15 +44,12 @@ RUN apt-get install -y mercurial python3-pip
RUN apk add mercurial py3-pip clang-analyzer
{{/alpine}}
+ {{#debian}}
# curl tries to load the CA certificates for libnss.
# It loads them from /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so,
# which is supplied by libnss3 on Debian/Ubuntu
- {{#debian}}
RUN apt-get install -y libnss3
{{/debian}}
- {{#alpine}}
-RUN apk add nss
- {{/alpine}}
{{/firefox}}
{{#chrome}}
# Dependencies for downloading and building BoringSSL
@@ -210,6 +207,12 @@ RUN chmod +x out/curl_*
# When using alpine, create a final, minimal image with the compiled binaries
# only.
FROM alpine:3.15.0
+{{#firefox}}
+# curl tries to load the CA certificates for libnss.
+# It loads them from /usr/lib/libnssckbi.so,
+# which is supplied by 'nss' on alpine.
+RUN apk add --no-cache nss
+{{/firefox}}
# Copy curl-impersonate from the builder image
COPY --from=builder /build/out/curl-impersonate /usr/local/bin/
diff --git a/firefox/Dockerfile.alpine b/firefox/Dockerfile.alpine
index 95511bb..91edcaa 100644
--- a/firefox/Dockerfile.alpine
+++ b/firefox/Dockerfile.alpine
@@ -20,10 +20,6 @@ RUN apk add autoconf automake pkgconfig libtool
# See https://firefox-source-docs.mozilla.org/security/nss/build.html#mozilla-projects-nss-building
RUN apk add mercurial py3-pip clang-analyzer
-# curl tries to load the CA certificates for libnss.
-# It loads them from /usr/lib/x86_64-linux-gnu/nss/libnssckbi.so,
-# which is supplied by libnss3 on Debian/Ubuntu
-RUN apk add nss
# Download and compile libbrotli
ARG BROTLI_VERSION=1.0.9
@@ -121,6 +117,10 @@ RUN chmod +x out/curl_*
# When using alpine, create a final, minimal image with the compiled binaries
# only.
FROM alpine:3.15.0
+# curl tries to load the CA certificates for libnss.
+# It loads them from /usr/lib/libnssckbi.so,
+# which is supplied by 'nss' on alpine.
+RUN apk add --no-cache nss
# Copy curl-impersonate from the builder image
COPY --from=builder /build/out/curl-impersonate /usr/local/bin/