feat: Optimize Dockerfile and update setup documentation - #111
feat: Optimize Dockerfile and update setup documentation#111igopalakrishna wants to merge 2 commits into
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. |
|
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
|
Let's revert the changes to the pb2.py files, and then as long as you think this is ready, we can merge! |
|
@igopalakrishna -- two fixes needed based on @s2t2's feedback:
|
|
@ajkhabbazi if you want to get this past the finish line, that would be great! |
|
Carries @igopalakrishna's commits forward with authorship intact. On top: merged Verified in the container: builds clean, pytest passes (830/37 skipped), and the Close this one once #173 merges. |
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.