mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2025-08-11 11:11:23 +00:00
Minimize Docker image size with multi-stage build
Minimize the size of the resulting Docker image size by using multi-stage build and copying the resulting binaries into a minimal Debian system. This was done with the Alpine Docker images up until now but not with the Debian images.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
# Python is needed for building libnss.
|
||||
# Use it as a common base.
|
||||
FROM python:3.10.1-slim-buster
|
||||
FROM python:3.10.1-slim-buster as builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
@@ -134,3 +134,14 @@ RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypt
|
||||
# Wrapper scripts
|
||||
COPY curl_chrome* curl_edge* curl_safari* out/
|
||||
RUN chmod +x out/curl_*
|
||||
|
||||
# Create a final, minimal image with the compiled binaries
|
||||
# only.
|
||||
FROM debian:buster-slim
|
||||
|
||||
# Copy curl-impersonate from the builder image
|
||||
COPY --from=builder /build/install /usr/local
|
||||
# Copy to /build/out as well for backward compatibility with previous versions.
|
||||
COPY --from=builder /build/out /build/out
|
||||
# Wrapper scripts
|
||||
COPY --from=builder /build/out/curl_* /usr/local/bin/
|
||||
|
Reference in New Issue
Block a user