Closed windbridges closed 4 months ago
Yes, you can utilize the binaries from the curl-impersonate Docker image in your own image without building it from source every time.
Here's an example using a multi-stage build:
FROM lwthiker/curl-impersonate:0.5.4-chrome-alpine AS curl-impersonate
# Your base image
FROM php-x
# Copy curl-impersonate binaries and wrapper scripts from the builder stage
COPY --from=curl-impersonate /usr/local /usr/local
# Rest of your Dockerfile...
Yes, you can utilize the binaries from the curl-impersonate Docker image in your own image without building it from source every time.
Here's an example using a multi-stage build:
FROM lwthiker/curl-impersonate:0.5.4-chrome-alpine AS curl-impersonate # Your base image FROM php-x # Copy curl-impersonate binaries and wrapper scripts from the builder stage COPY --from=curl-impersonate /usr/local /usr/local # Rest of your Dockerfile...
Could you please advise what the problem could be?
FROM lwthiker/curl-impersonate:0.5.4-chrome-alpine AS curl-impersonate
FROM php:8.2-cli AS base
# ....
COPY --from=curl-impersonate /usr/local /usr/local
------
> [php base 8/11] COPY --from=curl-impersonate /usr/local /usr/local:
------
failed to solve: cannot copy to non-directory: /var/lib/docker/overlay2/avlxqohz55jf4i4vl6jikhtrm/merged/usr/local/include/curl
@windbridges or anyone coming here
I made it work by issuing a
RUN rm -fR /usr/local/include/curl
before the COPY command
And found another issue
error while loading shared libraries: libcurl-impersonate-chrome.so.4
so modify the DOCKERFILE to add
RUN ldconfig
after the COPY
This seems to be resolved so I'm closing it.
Could you tell me if I can use the binaries from the https://hub.docker.com/r/lwthiker/curl-impersonate image inside my image?
Right now I'm building curl-impersonate completely from source inside dockerfile, but it's very slow. I want to get rid of that.
Why can't I just use the official image? For the reason that I use other php extensions besides curl-impersonate, and have my own Dockerfile.
As far as I understand, I need to copy some files from this image into my own so I can use the library. Any instructions on which files to copy?