go-wkhtmltopdf
go-wkhtmltopdf copied to clipboard
how let go-wkhtmltopdf know where is wkhtmltox/pdf.h
hi man, sorry i dont where else to ask this, the repo where i used the wkhtmltopdf image not responding the issue.
So, i try to use wkhtmltopdf on my dockerfile which look like this
FROM ghcr.io/surnet/alpine-wkhtmltopdf:3.17.0-0.12.6-small as wkhtmltopdf
FROM golang:1.19.9-alpine3.17
# Install dependencies for wkhtmltopdf
RUN apk add --no-cache \
libstdc++ libx11 libxrender libxext libssl1.1
ca-certificates fontconfig freetype ttf-dejavu \
ttf-droid ttf-freefont ttf-liberation \
# more fonts
&& apk add --no-cache --virtual .build-deps \
msttcorefonts-installer \
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps \
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
COPY --from=wkhtmltopdf /bin/libwkhtmltox* /bin/
WORKDIR /src
COPY . .
RUN go mod vendor && go mod verify
RUN go build -o main .
EXPOSE 8080
CMD ["./main"]
which totally fine when i havent install https://github.com/adrg/go-wkhtmltopdf
but when i install it and build again. its always throws this error error during docker build.
> [builder 7/7] RUN go build -o /app-bin /src/main.go:
#0 3.510 # github.com/adrg/go-wkhtmltopdf
#0 3.510 vendor/github.com/adrg/go-wkhtmltopdf/converter.go:7:10: fatal error: wkhtmltox/pdf.h: No such file or directory
#0 3.510 7 | #include <wkhtmltox/pdf.h>
#0 3.510 | ^~~~~~~~~~~~~~~~~
#0 3.510 compilation terminated
do you know how to let the go compiler where the wkhtmltox is ? i've stry specify cgo flags but still doesnt work
i really appreciate your answer,