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

Add docker multi stage build #17

Closed
wants to merge 1 commit into from
Closed

Conversation

sushshring
Copy link

@sushshring sushshring commented Jun 20, 2021

Creating a first draft, but may not work as intended. Needs some sanity checks from people that know the different details that are needed to run this. Also not tested by running the generated container bc I'm not clear on how the command is run. Details would be appreciated!

@derneuere
Copy link
Member

Alright, I created and uploaded the image. Building worked fine. The image name is derneuere/librephotos:multistage

To use the image you have to replace this line

image: reallibrephotos/librephotos:${tag}

There are three different kinds of scenarios we have to test:
Does it work with production with docker compose up
Does it work in dev with docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
And for the last test we need a user who has a CPU that does not support AVX

The test is successful if the user can login via the frontend.

I will ask on discord if anyone wants to help out :)

@alexislefebvre
Copy link
Contributor

Does it work for you?

I tried the new image, but it failed:

docker-compose up backend
librephotos-db_1 is up-to-date
librephotos-backend_1 is up-to-date
Attaching to librephotos-backend_1
backend_1   | statd: unrecognized service
backend_1   | Traceback (most recent call last):
backend_1   |   File "manage.py", line 22, in <module>
backend_1   |     execute_from_command_line(sys.argv)
backend_1   |   File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
backend_1   |     utility.execute()
backend_1   |   File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
backend_1   |     django.setup()
backend_1   |   File "/usr/local/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
backend_1   |     apps.populate(settings.INSTALLED_APPS)
backend_1   |   File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
backend_1   |     app_config.import_models()
backend_1   |   File "/usr/local/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
backend_1   |     self.models_module = import_module(models_module_name)
backend_1   |   File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
backend_1   |     return _bootstrap._gcd_import(name[level:], package, level)
backend_1   |   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
backend_1   |   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
backend_1   |   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
backend_1   |   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
backend_1   |   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
backend_1   |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
backend_1   |   File "/code/api/models/__init__.py", line 1, in <module>
backend_1   |     from api.models.album_auto import AlbumAuto
backend_1   |   File "/code/api/models/album_auto.py", line 4, in <module>
backend_1   |     from api.models.photo import Photo
backend_1   |   File "/code/api/models/photo.py", line 6, in <module>
backend_1   |     from api.im2txt.sample import im2txt
backend_1   |   File "/code/api/im2txt/sample.py", line 8, in <module>
backend_1   |     import torch
backend_1   | ModuleNotFoundError: No module named 'torch'
…
backend_1   | [2021-06-27 16:38:25 +0200] [53] [INFO] Worker exiting (pid: 53)
backend_1   | [2021-06-27 14:38:25 +0000] [49] [INFO] Shutting down: Master
backend_1   | [2021-06-27 14:38:25 +0000] [49] [INFO] Reason: Worker failed to boot.

My CPU doesn't have AVX. But when I look at the changes in this PR, I don't see how is it supposed to compile the image with or without AVX?

@sushshring
Copy link
Author

Got busy at work for a bit and the Dockerfile has changed quite heavily. I'll follow up on discord separately on how to improve this because the container is now ballooned up to nearly 8 gigs in size

@derneuere
Copy link
Member

As the build changed quite a bit, I will close this down. I think that #45 is the better way forward in order to reduce the size further.

@derneuere derneuere closed this Mar 7, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants