Git Product home page Git Product logo

Comments (8)

gen2brain avatar gen2brain commented on August 26, 2024 1

I just tried a basic example with the same Dockerfile and there are no issues.
So, I copied the example from README, test.pdf, I did go mod init example, then docker build --no-cache -t example and docker run -it example:latest, I also added some time.Sleep, so I can check with docker exec that files are created in /tmp/fitz*.

from go-fitz.

gen2brain avatar gen2brain commented on August 26, 2024

You don't need to install all those libraries if you are not building with extlib, just -tags musl is enough. So either don't install libraries or build with extlib, but in that case, you need 1.20.0 installed as there have been some changes.
See here for a minimal docker #35 (comment)

from go-fitz.

Ashutosh00710 avatar Ashutosh00710 commented on August 26, 2024

@gen2brain thanks for the quick response,

Tried this

FROM golang:alpine
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
COPY go.mod go.sum ./
COPY example.go test.pdf ./
RUN go mod download
RUN go build -tags musl -o /example
CMD [ "/example" ]

build was successful

But still getting this error âŦ‡ī¸

cannot create context: incompatible header (1.20.0) and library (1.18.0) versions
2022/06/26 09:25:35 fitz: cannot create context

from go-fitz.

Ashutosh00710 avatar Ashutosh00710 commented on August 26, 2024

Do you have any idea about cause of the issue?

This comes when it tries to read the PDF

cannot create context: incompatible header (1.20.0) and library (1.18.0) versions 
2022/06/26 09:25:35 fitz: cannot create context

from go-fitz.

gen2brain avatar gen2brain commented on August 26, 2024

Well, besides checking your go.mod file, or building a docker image without using the cache, no idea. Can you try the exact steps I did, does it work then?

from go-fitz.

Ashutosh00710 avatar Ashutosh00710 commented on August 26, 2024

I followed the exact steps. But it didn't worked ☚ī¸, image is running but at the time of reading the pdf, getting the context error mentioned above
This is my go.mod

module pdf-transcoder

go 1.17

require (
	github.com/aws/aws-sdk-go-v2 v1.16.5
	github.com/aws/aws-sdk-go-v2/config v1.15.11
	github.com/aws/aws-sdk-go-v2/service/s3 v1.26.11
	github.com/confluentinc/confluent-kafka-go v1.8.2
	github.com/gen2brain/go-fitz v1.20.0
	github.com/matoous/go-nanoid/v2 v2.0.0
)

require (
	github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.2 // indirect
	github.com/aws/aws-sdk-go-v2/credentials v1.12.6 // indirect
	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.6 // indirect
	github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.12 // indirect
	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.6 // indirect
	github.com/aws/aws-sdk-go-v2/internal/ini v1.3.13 // indirect
	github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.3 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.2 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.7 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.6 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.6 // indirect
	github.com/aws/aws-sdk-go-v2/service/sso v1.11.9 // indirect
	github.com/aws/aws-sdk-go-v2/service/sts v1.16.7 // indirect
	github.com/aws/smithy-go v1.11.3 // indirect
)

I am also building image using --no-cache flag

from go-fitz.

helios741 avatar helios741 commented on August 26, 2024

@Ashutosh00710
I have the same problem in v1.20.2 version, did you solve it?please

from go-fitz.

Ashutosh00710 avatar Ashutosh00710 commented on August 26, 2024

@helios741 This dockerfile worked for me.

FROM golang:alpine
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
COPY . .
RUN go mod download
RUN go build -tags musl -o /example
CMD [ "/example" ]

with

  • go-fitz (v 1.20.0)

from go-fitz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.