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

Docker size #39

Closed
rgarrigue opened this issue Oct 18, 2018 · 6 comments
Closed

Docker size #39

rgarrigue opened this issue Oct 18, 2018 · 6 comments
Assignees
Labels
enhancement Refactoring, improvement or maintenance task released Available in the stable release
Milestone

Comments

@rgarrigue
Copy link

Hi

I was wondering why downloading photoprism container took so much time...

image

May I suggest a multistage build ? Here's the doc https://docs.docker.com/develop/develop-images/multistage-build/

Basically, if you can make a standalone photoprism binary (aka no need for local third party)

FROM golang:1.7.3
# everything for build, until standalone photoprism bin is in say /bin/photoprism

FROM alpine:latest  
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /bin/photoprism .
ENTRYPOINT ["./photoprism"]
CMD ["start"]  
@lastzero
Copy link
Member

Yes, great idea. I guess we can remove lots of stuff from the development image related to TensorFlow and Python. It's there to experiment, but most of it is not used. But of course we need the TensorFlow model, HTML templates, JS & CSS code etc, so just a single binary is not enough.

Do you think it would work without any TensorFlow libs installed? I don't think so, but never tried.

@lastzero lastzero added help wanted Well suited for external contributors! idea Feedback wanted / feature request labels Oct 18, 2018
@lastzero lastzero added this to To do in Product Development & UX via automation Oct 18, 2018
@lastzero lastzero added this to the MVP milestone Oct 18, 2018
@rgarrigue
Copy link
Author

I don't know a thing about Photoprism, I just saw the project on github explore and wanted to gave a shot via docker. And I don't know a thing about Tensorflow either.

So, on a pure docker based point of view

  • Static assets can be provided like the bin, copy from build container / sources
  • If tensorflow in photoprism context can be used in a client/server way, it should. Then you can write a docker-compose.yml featuring "photoprism" your container, "tensorflow" for example https://hub.docker.com/r/tensorflow/tensorflow/.

@lastzero
Copy link
Member

I see. We use Tensorflow as a library for image classification. Doing this via rest means copying the contents (that are already in memory) to a different container via HTTP just to get some tag labels back. Can be done, but probably not very efficient. Also means maintaining another app as a server. There are (commercial) ready-to-use tensorflow based container images available for that though. Maybe worth an experiment if there is time. Not sure how small they are.

Our image certainly has to become smaller. Contains lots of dev only stuff right now.

@lastzero lastzero added enhancement Refactoring, improvement or maintenance task and removed help wanted Well suited for external contributors! idea Feedback wanted / feature request labels Nov 7, 2018
@lastzero lastzero self-assigned this Nov 7, 2018
@lastzero
Copy link
Member

lastzero commented Nov 7, 2018

Working on this right now... There will be a development base image and one for production without any dev / build tools.

@lastzero
Copy link
Member

lastzero commented Nov 8, 2018

Compressed size is 172 MB now. Build and push to Docker Hub performed by Travis CI whenever develop is merged into master.

lastzero added a commit that referenced this issue Nov 8, 2018
lastzero added a commit that referenced this issue Nov 8, 2018
@rgarrigue
Copy link
Author

Purrrfect, thanks !

Product Development & UX automation moved this from To do to Done Nov 8, 2018
@lastzero lastzero added the released Available in the stable release label Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Refactoring, improvement or maintenance task released Available in the stable release
Projects
No open projects
Development

No branches or pull requests

2 participants