Skip to content

Commit 3a98eb3

Browse files
committed
fixed dockerfile and updaed docs
1 parent bfdd123 commit 3a98eb3

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

Dockerfile

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ ARG USER_ID
44
ARG GROUP_ID
55
ENV DEBIAN_FRONTEND noninteractive
66

7-
RUN apt-get update && apt-get install -y git cmake make ruby gcc python3 python3-pip gcc-arm-none-eabi ninja-build gdb
7+
RUN apt-get update && apt-get install -y git cmake make ruby gcc python3 python3-pip gcc-arm-none-eabi ninja-build
8+
9+
RUN if [ "$GDB" = "yes" ]; then apt-get install -y gdb; fi
810

911
RUN pip install pyyaml
1012

1113
# if either of these are already set the same as the user's machine, leave them be and ignore the error
12-
RUN if [ -n "$USER_ID" ]; then RUN addgroup --gid $GROUP_ID inav; exit 0; fi
13-
RUN if [ -n "$USER_ID" ]; then RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID inav; exit 0; fi
14+
RUN addgroup --gid $GROUP_ID inav; exit 0;
15+
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID inav; exit 0;
16+
17+
ARG INAV_IMAGE_USER=inav
18+
USER $INAV_IMAGE_USER
1419

15-
RUN if [ -n "$USER_ID" ]; then USER inav; fi
1620
RUN git config --global --add safe.directory /src
1721

1822
VOLUME /src

docs/development/Building in Docker.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,24 @@ If you are getting error "standard_init_linux.go:219: exec user process caused:
3333

3434
You'll have to manually execute the same steps that the build script does:
3535

36-
1. `docker build -t inav-build .`
36+
1. `docker build --build-arg INAV_IMAGE_USER=root -t inav-build .`
3737
+ This step is only needed the first time.
38-
2. `docker run --rm -it -u root -v <PATH_TO_REPO>:/src inav-build <TARGET>`
38+
+ Note that on Windows/WSL 2 mounted /src folder is writeable for root user only. You have to run build under root user. This is achieved with `--build-arg INAV_IMAGE_USER=root` option in the command line above.
39+
+ If GDB should be installed in the image, add argument '--build-arg GDB=yes'
40+
2. `docker run --rm -it -v <PATH_TO_REPO>:/src inav-build <TARGET>`
3941
+ Where `<PATH_TO_REPO>` must be replaced with the absolute path of where you cloned this repo (see above), and `<TARGET>` with the name of the target that you want to build.
40-
+ Note that on Windows/WSL 2 mounted /src folder is writeable for root user only. You have to run build under root user. You can achieve this by using `-u root` option in the command line above.
4142

4243
3. If you need to update `Settings.md`, run:
4344

44-
`docker run --entrypoint /src/cmake/docker_docs.sh --rm -it -u root -v <PATH_TO_REPO>:/src inav-build`
45+
`docker run --entrypoint /src/cmake/docker_docs.sh --rm -it -v <PATH_TO_REPO>:/src inav-build`
4546

4647
4. Building SITL:
4748

48-
`docker run --rm --entrypoint /src/cmake/docker_build_sitl.sh -it -u root -v <PATH_TO_REPO>:/src inav-build`
49+
`docker run --rm --entrypoint /src/cmake/docker_build_sitl.sh -it -v <PATH_TO_REPO>:/src inav-build`
4950

5051
5. Running SITL:
5152

52-
`docker run -p 5760:5760 -p 5761:5761 -p 5762:5762 -p 5763:5763 -p 5764:5764 -p 5765:5765 -p 5766:5766 -p 5767:5767 --entrypoint /src/cmake/docker_run_sitl.sh --rm -it -u root -v <PATH_TO_REPO>:/src inav-build`.
53+
`docker run -p 5760:5760 -p 5761:5761 -p 5762:5762 -p 5763:5763 -p 5764:5764 -p 5765:5765 -p 5766:5766 -p 5767:5767 --entrypoint /src/cmake/docker_run_sitl.sh --rm -it -v <PATH_TO_REPO>:/src inav-build`.
5354
+ SITL command line parameters can be adjusted in `cmake/docker_run_sitl.sh`.
5455

5556
Refer to the [Linux](#Linux) instructions or the [build script](/build.sh) for more details.

0 commit comments

Comments
 (0)