manugarg / pacparser

A library to parse proxy auto-config (PAC) files
http://pacparser.manugarg.com
GNU Lesser General Public License v3.0
506 stars 116 forks source link

docker usage #190

Closed stefangweichinger closed 5 months ago

stefangweichinger commented 9 months ago

Could you provide an example for using the docker-image? I built the image:

 docker build -t pacparser .
[+] Building 0.9s (12/12) FINISHED                                                                                                                                                        docker:default
 => [internal] load .dockerignore                                                                                                                                                                   0.1s
 => => transferring context: 2B                                                                                                                                                                     0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                0.1s
 => => transferring dockerfile: 823B                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                                    0.6s
 => [internal] load build context                                                                                                                                                                   0.0s
 => => transferring context: 26.12kB                                                                                                                                                                0.0s
 => [build-stage 1/5] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                                                  0.0s
 => CACHED [stage-1 2/3] WORKDIR /app                                                                                                                                                               0.0s
 => CACHED [build-stage 2/5] RUN apk update && apk add --no-cache     gcc     git     g++     bash     make                                                                                         0.0s
 => CACHED [build-stage 3/5] WORKDIR /build                                                                                                                                                         0.0s
 => CACHED [build-stage 4/5] COPY src /build                                                                                                                                                        0.0s
 => CACHED [build-stage 5/5] RUN make pactester                                                                                                                                                     0.0s
 => CACHED [stage-1 3/3] COPY --from=build-stage /build/pactester /app/                                                                                                                             0.0s
 => exporting to image                                                                                                                                                                              0.0s
 => => exporting layers                                                                                                                                                                             0.0s
 => => writing image sha256:7c23c2a3b4282bb5016268fe645dd5560d6195a778214435fb58aab235ccef46                                                                                                        0.0s
 => => naming to docker.io/library/pacparser

and try something like:

docker run pacparser -p myproxy.pac  -u https://www.orf.at
exec /app/pactester: no such file or directory

docker run pacparser pactester -p myproxy.pac  -u https://www.orf.at
exec /app/pactester: no such file or directory

help appreciated!

manugarg commented 9 months ago

This is how the provided docker image runs:

14:13:04 @frodo ~$ docker run ghcr.io/manugarg/pactester:main
pactester.c: You didn't specify the PAC file

Usage:  /app/pactester <-p pacfile> <-u url> [-h host] [-c client_ip] [-e]
        /app/pactester <-p pacfile> <-f urlslist> [-c client_ip] [-e]

Options:
  -p pacfile   : PAC file to test (specify '-' to read from standard input)
  -u url       : URL to test for
  -h host      : Host part of the URL
  -c client_ip : client IP address (as returned by myIpAddres() function
                 in PAC files), defaults to IP address on which it is running.
  -e           : Deprecated: IPv6 extensions are enabledby default now.
  -f urlslist  : a file containing list of URLs to be tested.
  -v           : print version and exit

Not sure what's going on when you build it, but it may be an architecture issue. Which platform are you building it on?

Also see how project builds this docker image: https://github.com/manugarg/pacparser/blob/ee84e9824747f2f6bca054b5c2a05f53f479be72/Makefile#L19