Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/bin/sh: wkhtmltopdf: not found #35

Closed
yuertongle-fs opened this issue Jan 11, 2023 · 4 comments
Closed

/bin/sh: wkhtmltopdf: not found #35

yuertongle-fs opened this issue Jan 11, 2023 · 4 comments

Comments

@yuertongle-fs
Copy link

Below is my Dockerfile

FROM surnet/alpine-wkhtmltopdf:3.15.0-0.12.6-small as wkhtmltopdf
FROM fundingsocietiesdocker/golang:1.18.0-alpine3.15

# Set destination for COPY
WORKDIR /app
USER root


# 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 wkhtmltopdf files from docker-wkhtmltopdf image
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
COPY --from=wkhtmltopdf /bin/libwkhtmltox* /bin/
RUN chmod +x /bin/wkhtmltopdf



#for installing GCC
RUN apk add build-base

# Download Go modules
COPY go.mod .
COPY go.sum .
RUN go mod download

# Copy the source code. Note the slash at the end, as explained in
# https://docs.docker.com/engine/reference/builder/#copy
COPY *.go ./
COPY *.html ./

# Build
RUN go build -o /docker-gs-ping

# This is for documentation purposes only.
# To actually open the port, runtime parameters
# must be supplied to the docker command.
EXPOSE 8080

# (Optional) environment variable that our dockerised
# application can make use of. The value of environment
# variables can also be set via parameters supplied
# to the docker command on the command line.
#ENV HTTP_PORT=8081

# Run
CMD [ "/docker-gs-ping" ]

after I build the image and run it, I got below in the container -> terminal

/app # which wkhtmltopdf
/bin/wkhtmltopdf
/app # 
/app # 
/app # 
/app # wkhtmltopdf
/bin/sh: wkhtmltopdf: not found
@jpjonte
Copy link

jpjonte commented Jan 16, 2023

Same issue here, using this Dockerfile from the readme:

https://github.com/Surnet/docker-wkhtmltopdf#other-images

Edit: Just realized this issue only occurs with my custom base image. If I use the normal alpine image everything works.
I'll have to investigate further. So far it looks like an arch issue with my base image.

@jpjonte
Copy link

jpjonte commented Jan 17, 2023

Update: In my case the issue was that the base image wasn't available for the architecture I was building on (arm64).
After rebuilding my base image for both amd64 and arm64 I was able to build and use wkhtmltopdf.

@yuertongle-fs are you building on an arm machine? As far as I can tell, your base image fundingsocietiesdocker/golang is only available for amd64. Perhaps that is your issue, too.

@yuertongle-fs
Copy link
Author

amd64

Ah, I see. Should be for the machine I'm using. I'm running the docker on Apple M1(ARM-based system)

@chdanielmueller
Copy link
Member

Thanks @jpjonte that you did troubleshoot this and post your solution.
I'm closing this issue as solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants