feat: Optimize Dockerfile and update setup documentation#111
Open
igopalakrishna wants to merge 2 commits intogoogle:copybara_pushfrom
Open
feat: Optimize Dockerfile and update setup documentation#111igopalakrishna wants to merge 2 commits intogoogle:copybara_pushfrom
igopalakrishna wants to merge 2 commits intogoogle:copybara_pushfrom
Conversation
|
@igopalakrishna @s2t2 Tried testing this PR locally (Windows + Docker Desktop). The Docker build fails at the apt install step: E: Unable to locate package python3.10-venv CI also shows a failing ubuntu-latest (Py3.11) job. Suggest switching the base image to Ubuntu 22.04 (jammy) or adjusting the Python install approach, then re-running CI. |
Collaborator
|
Thanks @ajkhabbazi for the review! Let's use Python 3.11 in the Docker file, to match the other operating environments. |
- Replace Ubuntu 20.04 + deadsnakes with python:3.11-slim - Update protobuf to ^4.25.0 (TF 2.15.1 compatible) - Update grpcio-tools to ^1.60.0 - Regenerate protobuf files for protobuf 4.x compatibility - Add Apple Silicon notes to Docker docs - Regenerate poetry.lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #80
This PR completely revamps the project's Docker setup to improve dependency management, build efficiency, and user experience, addressing all points outlined in the issue.
A) Dependency Management (
pyproject.toml&Dockerfile)pip installstep from theDockerfile.jupyter,ipykernel,ipython) into a new[tool.poetry.group.notebooks]group inpyproject.toml.grpcio-toolsas a development dependency to ensure reliable.protofile compilation within the Python environment.protobufversion to^4.25.0to resolve a dependency conflict withgrpcio-tools.B) & C) Dockerfile Optimization
Dockerfilenow follows modern conventions, including:WORKDIRinstead ofRUN cd.SHELL ["/bin/bash", "-o", "pipefail", "-c"]to ensure build steps fail correctly.curlconsistently instead ofwget.RUNcommands have been restructured into logical layers to improve Docker's layer caching and significantly speed up subsequent builds.pyproject.tomlandpoetry.lockbefore installing dependencies, preventing re-installation on minor code changes.start.sh) and thegit clonestep have been removed in favor of a cleanerCOPY . .and a directCMDinstruction.CMDfor a better developer experience, matching the originalDockerfile's intent.Expanded Documentation (
docs/setup/docker.md)pytestsuite or accessing an interactive shell, as requested in the issue.How to Test
docker build -t sbsim .docker run -p 8888:8888 sbsimhttp://localhost:8888.docker exec <container_name> poetry run pytestKnown Issue
The test suite fails with a
Fatal Python error: Illegal instructionwhen run inside the container on an Apple Silicon (ARM) Mac. This is a known issue related to CPU instruction sets when running TensorFlow in an emulated environment and is outside the scope of the Dockerfile optimizations. TheDockerfilebuilds successfully, the Jupyter server runs, and thedocker execcommand is correctly configured for users on native x86/amd64 systems.