h2non / bimg

Go package for fast high-level image processing powered by libvips C library
https://pkg.go.dev/github.com/h2non/bimg?tab=doc
MIT License
2.68k stars 337 forks source link

Question: is it possible to statically compile all dependencies into a single standalone binary? #375

Open juan88 opened 3 years ago

juan88 commented 3 years ago

Hello!

I have installed vips following the recommendations and I would like if possible to deploy a binary containing all the dependencies so that is it possible to deploy it in an AWS Lambda.

I've tried this in order to compile statically (first time doing so, I do not know exactly if it is ok) but I found some errors.

env CGO_ENABLED=0 GOOS=linux go build -a -o imgcomps
# github.com/h2non/bimg
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:93:49: undefined: Gravity
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:133:29: undefined: Watermark
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:139:34: undefined: WatermarkImage
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:152:26: undefined: Angle
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:181:31: undefined: Interpretation
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:202:27: undefined: Options
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:212:29: undefined: ImageMetadata
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:218:35: undefined: Interpretation
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/image.go:234:25: undefined: ImageSize
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/resize.go:11:27: undefined: Options
../../../go/pkg/mod/github.com/h2non/bimg@v1.1.5/resize.go:11:27: too many errors

I'm using go version GOVERSION="go1.16.2" under Linux Mint.

In case that this is not possible, should I look into the possibility of installing vips and compiling my app insde a lambda aws docker image?

Thank you so much for your work and time!

anotherglitchinthematrix commented 3 years ago

I've used the latter option before, a docker image with all the dependencies installed, works perfectly. But if there is an option to package it with all the dependencies I also want to learn it.

HamzaAnis commented 2 years ago

Is there any update on it if it is possible?

samtoya commented 1 year ago

I've used the latter option before, a docker image with all the dependencies installed, works perfectly. But if there is an option to package it with all the dependencies I also want to learn it.

@anotherglitchinthematrix What docker image did you install to get this issue resolved?