mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-09 04:54:23 +08:00
Compare commits
1 Commits
tools
...
dockerize-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be63625fa8 |
@@ -18,6 +18,19 @@
|
||||
|
||||
venv/
|
||||
.venv/
|
||||
**/.idea
|
||||
**/.hypothesis
|
||||
**/.mypy_cache
|
||||
|
||||
**/.venv
|
||||
**/.venv/
|
||||
|
||||
**/.ci_cache
|
||||
**/*.rlog
|
||||
|
||||
**/Dockerfile*
|
||||
**/dockerfile*
|
||||
**/build_output
|
||||
|
||||
notebooks
|
||||
phone
|
||||
|
||||
66
Dockerfile.sunnypilot
Normal file
66
Dockerfile.sunnypilot
Normal file
@@ -0,0 +1,66 @@
|
||||
FROM sunnypilot-base
|
||||
|
||||
ARG RUNNER_DEBUG=0
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV OPENPILOT_SRC_PATH=/tmp/openpilot
|
||||
ENV BUILD_DIR=/data/openpilot
|
||||
ENV OUTPUT_DIR=/output
|
||||
|
||||
RUN sudo apt update && sudo apt install -y rsync
|
||||
|
||||
RUN mkdir -p ${OPENPILOT_SRC_PATH}
|
||||
RUN mkdir -p ${BUILD_DIR}
|
||||
COPY . ${OPENPILOT_SRC_PATH}
|
||||
ENV PYTHONPATH=${BUILD_DIR}
|
||||
|
||||
WORKDIR ${OPENPILOT_SRC_PATH}
|
||||
RUN ./tools/ubuntu_setup.sh
|
||||
|
||||
RUN ./release/release_files.py | sort | uniq | rsync -rRl${RUNNER_DEBUG:+v} --files-from=- . $BUILD_DIR/
|
||||
WORKDIR ${BUILD_DIR}
|
||||
RUN sed -i '/from .board.jungle import PandaJungle, PandaJungleDFU/s/^/#/' panda/__init__.py
|
||||
RUN scons --cache-readonly -j$(nproc) --minimal
|
||||
RUN touch ${BUILD_DIR}/prebuilt
|
||||
RUN sudo rm -rf ${OUTPUT_DIR}
|
||||
RUN mkdir -p ${OUTPUT_DIR}
|
||||
|
||||
ENTRYPOINT [\
|
||||
"rsync", \
|
||||
"-am", \
|
||||
"--include=**/panda/board/", \
|
||||
"--include=**/panda/board/obj", \
|
||||
"--include=**/panda/board/obj/panda.bin.signed", \
|
||||
"--include=**/panda/board/obj/panda_h7.bin.signed", \
|
||||
"--include=**/panda/board/obj/bootstub.panda.bin", \
|
||||
"--include=**/panda/board/obj/bootstub.panda_h7.bin", \
|
||||
"--exclude=.sconsign.dblite", \
|
||||
"--exclude=*.a", \
|
||||
"--exclude=*.o", \
|
||||
"--exclude=*.os", \
|
||||
"--exclude=*.pyc", \
|
||||
"--exclude=moc_*", \
|
||||
"--exclude=*.cc", \
|
||||
"--exclude=Jenkinsfile", \
|
||||
"--exclude=supercombo.onnx", \
|
||||
"--exclude=**/panda/board/*", \
|
||||
"--exclude=**/panda/board/obj/**", \
|
||||
"--exclude=**/panda/certs/", \
|
||||
"--exclude=**/panda/crypto/", \
|
||||
"--exclude=**/release/", \
|
||||
"--exclude=**/.github/", \
|
||||
"--exclude=**/selfdrive/ui/replay/", \
|
||||
"--exclude=**/__pycache__/", \
|
||||
"--exclude=**/selfdrive/ui/*.h", \
|
||||
"--exclude=**/selfdrive/ui/**/*.h", \
|
||||
"--exclude=**/selfdrive/ui/qt/offroad/sunnypilot/", \
|
||||
#"--exclude=${SCONS_CACHE_DIR:-}", \
|
||||
"--exclude=**/.git/", \
|
||||
"--exclude=**/SConstruct", \
|
||||
"--exclude=**/SConscript", \
|
||||
"--exclude=**/.venv/", \
|
||||
"--delete-excluded", \
|
||||
"--chown=1000:1000", \
|
||||
"/data/openpilot/", \
|
||||
"/output/" \
|
||||
]
|
||||
51
release/ci/docker_build_sp.sh
Normal file
51
release/ci/docker_build_sp.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
# run_openpilot_docker.sh
|
||||
# POSIX-compliant script to run openpilot in Docker for local testing
|
||||
|
||||
# === Configurable Variables ===
|
||||
|
||||
# Base image to use (required)
|
||||
BASE_IMAGE="${BASE_IMAGE:-commaai/openpilot-base:latest}"
|
||||
|
||||
# Working directory inside the container
|
||||
WORKDIR="/tmp/openpilot"
|
||||
|
||||
# Local project path
|
||||
LOCAL_DIR="$PWD"
|
||||
|
||||
# Shared memory size (adjust for large builds/tests)
|
||||
SHM_SIZE="2G"
|
||||
|
||||
# Environment configuration
|
||||
CI=1
|
||||
PYTHONWARNINGS="error"
|
||||
FILEREADER_CACHE=1
|
||||
PYTHONPATH="$WORKDIR"
|
||||
|
||||
# Optional: GitHub Actions env vars — set them only if needed for local mirroring/debug
|
||||
USE_GITHUB_ENV_VARS=false # set to true to enable GitHub-related mounts/envs
|
||||
GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-$HOME/openpilot_ci}" # fallback path
|
||||
|
||||
# === Docker Command ===
|
||||
|
||||
docker run --rm \
|
||||
--shm-size "$SHM_SIZE" \
|
||||
-v "$LOCAL_DIR":"$WORKDIR" \
|
||||
-w "$WORKDIR" \
|
||||
-e CI="$CI" \
|
||||
-e PYTHONWARNINGS="$PYTHONWARNINGS" \
|
||||
-e FILEREADER_CACHE="$FILEREADER_CACHE" \
|
||||
-e PYTHONPATH="$PYTHONPATH" \
|
||||
${USE_GITHUB_ENV_VARS:+\
|
||||
-e NUM_JOBS \
|
||||
-e JOB_ID \
|
||||
-e GITHUB_ACTION \
|
||||
-e GITHUB_REF \
|
||||
-e GITHUB_HEAD_REF \
|
||||
-e GITHUB_SHA \
|
||||
-e GITHUB_REPOSITORY \
|
||||
-e GITHUB_RUN_ID \
|
||||
-v "$GITHUB_WORKSPACE/.ci_cache/scons_cache":/tmp/scons_cache \
|
||||
-v "$GITHUB_WORKSPACE/.ci_cache/comma_download_cache":/tmp/comma_download_cache \
|
||||
-v "$GITHUB_WORKSPACE/.ci_cache/openpilot_cache":/tmp/openpilot_cache } \
|
||||
"$BASE_IMAGE" /bin/bash -c "${1:-/bin/bash}"
|
||||
Reference in New Issue
Block a user