Skip to content

Commit 6a68268

Browse files
committed
docker: Add fork handling in Containerfile
Implement fork handling by adding a new stage to configure the git remote for the fork repository, fetch its contents, and create a new branch for further development. Signed-off-by: Chiho Sin <[email protected]>
1 parent ce4be43 commit 6a68268

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Containerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,14 @@ RUN if [ "${BUILD_PLATFORM}" = "zephyr-cp" ]; then \
132132
&& west sdk install; \
133133
fi
134134

135+
FROM port AS fork
136+
137+
RUN git config --global --add safe.directory /workspace \
138+
&& git config --global protocol.file.allow always \
139+
&& git remote add fork "${BUILD_FORK_REPO}" \
140+
&& git fetch fork --filter=tree:0 \
141+
&& git checkout -b fork-branch "fork/${BUILD_FORK_REF}" \
142+
&& git repack -d
143+
135144
COPY --chmod=0755 entrypoint.sh /entrypoint.sh
136145
ENTRYPOINT [ "/entrypoint.sh" ]

0 commit comments

Comments
 (0)