You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The base Docker images in directory `.ci/docker/` are built by the `docker-builds.yml` workflow. Those images are used throughout the PyTorch CI/CD pipeline. You should only create or modify a base Docker image if you need specific environment changes or dependencies before building PyTorch on CI.
45
+
46
+
1. **Automatic Rebuilding**:
47
+
- The Docker image building process is triggered automatically when changes are made to files in the `.ci/docker/*` directory
48
+
- This ensures all images stay up-to-date with the latest dependencies and configurations
49
+
50
+
2. **Image Reuse in PyTorch Build Workflows** (example: linux-build):
51
+
- The images generated by `docker-builds.yml` are reused in `_linux-build.yml` through the `calculate-docker-image` step
52
+
- The `_linux-build.yml` workflow:
53
+
- Pulls the Docker image determined by the `calculate-docker-image` step
54
+
- Runs a Docker container with that image
55
+
- Executes `.ci/pytorch/build.sh` inside the container to build PyTorch
56
+
57
+
3. **Usage in Test Workflows** (example: linux-test):
58
+
- The same Docker images are also used in `_linux-test.yml` for running tests
59
+
- The `_linux-test.yml` workflow follows a similar pattern:
60
+
- It uses the `calculate-docker-image` step to determine which Docker image to use
61
+
- It pulls the Docker image and runs a container with that image
62
+
- It installs the wheels from the artifacts generated by PyTorch build jobs
63
+
- It executes test scripts (like `.ci/pytorch/test.sh` or `.ci/pytorch/multigpu-test.sh`) inside the container
64
+
65
+
### Understanding File Purposes
66
+
67
+
#### `.ci/docker/build.sh` vs `.ci/pytorch/build.sh`
68
+
- **`.ci/docker/build.sh`**:
69
+
- Used for building base Docker images
70
+
- Executed by the `docker-builds.yml` workflow to pre-build Docker images for CI
71
+
- Contains configurations for different Docker build environments
72
+
73
+
- **`.ci/pytorch/build.sh`**:
74
+
- Used for building PyTorch inside a Docker container
75
+
- Called by workflows like `_linux-build.yml` after the Docker container is started
76
+
- Builds PyTorch wheels and other artifacts
77
+
78
+
#### `.ci/docker/ci_commit_pins/` vs `.github/ci_commit_pins`
79
+
- **`.ci/docker/ci_commit_pins/`**:
80
+
- Used for pinning dependency versions during base Docker image building
81
+
- Ensures consistent environments for building PyTorch
82
+
- Changes here trigger base Docker image rebuilds
83
+
84
+
- **`.github/ci_commit_pins`**:
85
+
- Used for pinning dependency versions during PyTorch building and tests
86
+
- Ensures consistent dependencies for PyTorch across different builds
87
+
- Used by build scripts running inside Docker containers
88
+
89
+
### Step-by-Step Guide for Adding a New Base Docker Image
90
+
91
+
#### 1. Add Pinned Commits (If Applicable)
92
+
93
+
We use pinned commits for build stability. The `nightly.yml` workflow checks and updates pinned commits for certain repository dependencies daily.
94
+
95
+
If your new Docker image needs a library installed from a specific pinned commit or built from source:
96
+
97
+
1. Add the repository you want to track in `nightly.yml` and `merge-rules.yml`
98
+
2. Add the initial pinned commit in `.ci/docker/ci_commit_pins/`. The text filename should match the one defined in step 1
99
+
100
+
#### 2. Configure the Base Docker Image
101
+
1. **Add new Base Docker image configuration** (if applicable):
102
+
103
+
Add the configuration in `.ci/docker/build.sh`. For example:
0 commit comments