split dockerfile into base image and CI image (#2066)

* split dockerfile into base image and CI

* doesn't exist yet

* fix path

* cache on this branch

* latest

* use cache

* don't double pull
old-commit-hash: a3f5643019
commatwo_master
Adeeb Shihadeh 5 years ago committed by GitHub
parent 8f2111b889
commit 993b6b43ac
  1. 16
      .dockerignore
  2. 13
      .github/workflows/test.yaml
  3. 42
      Dockerfile.openpilot_base
  4. 24
      Dockerfile.openpilotci
  5. 2
      Jenkinsfile

@ -1,5 +1,21 @@
.git .git
.DS_Store .DS_Store
*.dylib
*.DSYM
*.d
*.pyc
*.pyo
.*.swp
.*.swo
.*.un~
*.tmp
*.o
*.o-*
*.os
*.os-*
*.so
*.a
notebooks notebooks
phone phone
massivemap massivemap

@ -11,9 +11,14 @@ env:
CI_RUN: docker run -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID --rm tmppilotci /bin/bash -c CI_RUN: docker run -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID --rm tmppilotci /bin/bash -c
UNIT_TEST: coverage run --append -m unittest discover UNIT_TEST: coverage run --append -m unittest discover
BUILD: | BUILD: |
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile.openpilot) || true # build the openpilot docker base image
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile.openpilot_base) || true
docker pull docker.io/commaai/openpilot-base:latest || true
docker build --cache-from docker.io/commaai/openpilot-base:latest -t commaai/openpilot-base:latest -f Dockerfile.openpilot_base .
# build the final CI image
docker pull docker.io/commaai/openpilotci:latest || true docker pull docker.io/commaai/openpilotci:latest || true
docker build --cache-from docker.io/commaai/openpilotci:latest -t tmppilot -f Dockerfile.openpilot . docker build --cache-from docker.io/commaai/openpilotci:latest -t tmppilot -f Dockerfile.openpilotci .
jobs: jobs:
build_release: build_release:
@ -30,7 +35,7 @@ jobs:
run: | run: |
mkdir $TEST_DIR mkdir $TEST_DIR
cp -pR --parents $(cat release/files_common) $TEST_DIR cp -pR --parents $(cat release/files_common) $TEST_DIR
cp Dockerfile.openpilot $TEST_DIR cp Dockerfile.openpilot_base Dockerfile.openpilotci $TEST_DIR
# need this to build on x86 # need this to build on x86
cp -pR --parents phonelibs/libyuv phonelibs/snpe \ cp -pR --parents phonelibs/libyuv phonelibs/snpe \
@ -88,6 +93,8 @@ jobs:
- name: Push to dockerhub - name: Push to dockerhub
run: | run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}} docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}}
docker tag commaai/openpilot-base:latest docker.io/commaai/openpilot-base:latest
docker push docker.io/commaai/openpilot-base:latest
docker tag tmppilot docker.io/commaai/openpilotci:latest docker tag tmppilot docker.io/commaai/openpilotci:latest
docker push docker.io/commaai/openpilotci:latest docker push docker.io/commaai/openpilotci:latest

@ -1,6 +1,5 @@
FROM ubuntu:16.04 FROM ubuntu:16.04
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH}
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \ autoconf \
@ -58,42 +57,5 @@ RUN pyenv install 3.8.2 && \
pip install --no-cache-dir --upgrade pip==20.1.1 && \ pip install --no-cache-dir --upgrade pip==20.1.1 && \
pip install --no-cache-dir pipenv==2018.11.26 && \ pip install --no-cache-dir pipenv==2018.11.26 && \
cd /tmp && \ cd /tmp && \
pipenv install --system --deploy --clear && \ pipenv install --system --deploy --dev --clear && \
pip uninstall -y pipenv && \ pip uninstall -y pipenv
pip install --no-cache-dir \
matplotlib==3.1.1 \
dictdiffer==0.8.0 \
fastcluster==1.1.25 \
aenum==2.2.1 \
lru-dict==1.1.6 \
scipy==1.4.1 \
tenacity==5.1.1 \
azure-common==1.1.23 \
azure-nspkg==3.0.2 \
azure-storage-blob==2.1.0 \
azure-storage-common==2.1.0 \
azure-storage-nspkg==3.1.0 \
pycurl==7.43.0.3 \
coverage==5.1 \
pre-commit==2.4.0 \
parameterized==0.7.4
RUN mkdir -p /tmp/openpilot
COPY SConstruct \
.pylintrc \
.pre-commit-config.yaml \
/tmp/openpilot/
COPY ./pyextra /tmp/openpilot/pyextra
COPY ./phonelibs /tmp/openpilot/phonelibs
COPY ./laika /tmp/openpilot/laika
COPY ./laika_repo /tmp/openpilot/laika_repo
COPY ./rednose /tmp/openpilot/rednose
COPY ./tools /tmp/openpilot/tools
COPY ./release /tmp/openpilot/release
COPY ./common /tmp/openpilot/common
COPY ./opendbc /tmp/openpilot/opendbc
COPY ./cereal /tmp/openpilot/cereal
COPY ./panda /tmp/openpilot/panda
COPY ./selfdrive /tmp/openpilot/selfdrive

@ -0,0 +1,24 @@
FROM commaai/openpilot-base:latest
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH}
RUN mkdir -p /tmp/openpilot
COPY SConstruct \
.pylintrc \
.pre-commit-config.yaml \
/tmp/openpilot/
COPY ./pyextra /tmp/openpilot/pyextra
COPY ./phonelibs /tmp/openpilot/phonelibs
COPY ./laika /tmp/openpilot/laika
COPY ./laika_repo /tmp/openpilot/laika_repo
COPY ./rednose /tmp/openpilot/rednose
COPY ./tools /tmp/openpilot/tools
COPY ./release /tmp/openpilot/release
COPY ./common /tmp/openpilot/common
COPY ./opendbc /tmp/openpilot/opendbc
COPY ./cereal /tmp/openpilot/cereal
COPY ./panda /tmp/openpilot/panda
COPY ./selfdrive /tmp/openpilot/selfdrive

2
Jenkinsfile vendored

@ -70,7 +70,7 @@ pipeline {
stage('PC tests') { stage('PC tests') {
agent { agent {
dockerfile { dockerfile {
filename 'Dockerfile.openpilot' filename 'Dockerfile.openpilotci'
args '--privileged --shm-size=1G --user=root' args '--privileged --shm-size=1G --user=root'
} }
} }

Loading…
Cancel
Save