bimg icon indicating copy to clipboard operation
bimg copied to clipboard

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

Open juan88 opened this issue 4 years ago • 3 comments

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/[email protected]/image.go:93:49: undefined: Gravity
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:133:29: undefined: Watermark
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:139:34: undefined: WatermarkImage
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:152:26: undefined: Angle
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:181:31: undefined: Interpretation
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:202:27: undefined: Options
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:212:29: undefined: ImageMetadata
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:218:35: undefined: Interpretation
../../../go/pkg/mod/github.com/h2non/[email protected]/image.go:234:25: undefined: ImageSize
../../../go/pkg/mod/github.com/h2non/[email protected]/resize.go:11:27: undefined: Options
../../../go/pkg/mod/github.com/h2non/[email protected]/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!

juan88 avatar Jun 22 '21 16:06 juan88

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.

Is there any update on it if it is possible?

HamzaAnis avatar Feb 13 '22 22:02 HamzaAnis

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?

samtoya avatar Oct 26 '22 15:10 samtoya