Skip to content

Commit 6c7eb66

Browse files
febrezoFintasticMan
authored andcommitted
Fix git hash calculation with Docker build
Fix error when compiling the Pinetime using the Docker image. If done with Docker, the container does not trust the /sources folder, leading to a blank response of the command that grabs the git commit `git rev-parse --short HEAD`. ``` fatal: detected dubious ownership in repository at '/sources' To add an exception for this directory, call: git config --global --add safe.directory /sources PROJECT_GIT_COMMIT_HASH_SUCCESS? 128 BUILD CONFIGURATION ------------------- * Mode : Release * Version : 1.3.0 * Toolchain : /opt/gcc-arm-none-eabi-10.3-2021.10 * GitRef(S) : * NRF52 SDK : /opt/nRF5_SDK_15.3.0_59ac345 * Target device : PINETIME * Build DFU (using adafruit-nrfutil) : Enabled * Build resources : Enabled ``` If the `git config --global --add safe.directory /sources` is added to the Dockerfile, the problem is solved and the hash is added correctly.
1 parent 4dd0d60 commit 6c7eb66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docker/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ RUN bash -c "source /opt/build.sh; GetMcuBoot;"
6464

6565
# Add the infinitime user for connecting devcontainer
6666
RUN adduser infinitime
67-
67+
68+
# Configure Git to accept the /sources directory as safe
69+
RUN git config --global --add safe.directory /sources
70+
6871
ENV SOURCES_DIR /sources
6972
CMD ["/opt/build.sh"]

0 commit comments

Comments
 (0)