diff --git a/ansible/roles/build_tools/tasks/main.yaml b/ansible/roles/build_tools/tasks/main.yaml index 91f8718a039..836501f6a94 100644 --- a/ansible/roles/build_tools/tasks/main.yaml +++ b/ansible/roles/build_tools/tasks/main.yaml @@ -8,7 +8,7 @@ - name: Add CCACHE_DIR to .bashrc ansible.builtin.lineinfile: dest: ~/.bashrc - line: export CCACHE_DIR="/ccache" + line: export CCACHE_DIR="/var/tmp/ccache" state: present create: true mode: 0644 @@ -28,3 +28,15 @@ state: present create: true mode: 0644 + +- name: Create ccache directory + ansible.builtin.file: + path: /var/tmp/ccache + state: directory + mode: 0755 + +- name: Source .bashrc + ansible.builtin.shell: source ~/.bashrc + args: + executable: /bin/bash + changed_when: false diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index 7b8919b20b9..3a2a7095ce8 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -45,6 +45,9 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG SETUP_ARGS ARG ROS_DISTRO +ENV CCACHE_DIR="/var/tmp/ccache" +ENV CC="/usr/lib/ccache/gcc" +ENV CXX="/usr/lib/ccache/g++" # Set up development environment RUN --mount=type=ssh \ @@ -71,7 +74,7 @@ RUN --mount=type=ssh \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ && find /autoware/install -type d -exec chmod 777 {} \; \ - && chmod -R 777 /ccache \ + && chmod -R 777 /var/tmp/ccache \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ && rm -rf /autoware/build /autoware/src