-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b86f0b9
commit d3a7546
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Development environment for libcanard, based on Ubuntu 20.04 Focal | ||
# | ||
# This software is distributed under the terms of the MIT License. | ||
# Copyright (c) 2021 UAVCAN Consortium. | ||
# Author: Kalyan Sriram <kalyan@coderkalyan.com> | ||
|
||
FROM ubuntu:focal | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
RUN apt-get update && apt-get -y upgrade | ||
RUN apt-get -y --no-install-recommends install \ | ||
build-essential cmake gcc-multilib g++-multilib \ | ||
clang-tidy-12 clang-format-12 \ | ||
gcc-avr avr-libc \ | ||
sudo curl git ca-certificates | ||
|
||
# borrowed from MAVSDK https://github.com/mavlink/MAVSDK/blob/main/docker/Dockerfile-Ubuntu-20.04 | ||
RUN curl -L https://github.com/ncopa/su-exec/archive/dddd1567b7c76365e1e0aac561287975020a8fad.tar.gz | tar xvz && \ | ||
cd su-exec-* && make && mv su-exec /usr/local/bin && cd .. && rm -rf su-exec-* | ||
|
||
RUN useradd --shell /bin/bash -u 1001 -c "" -m user | ||
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
||
WORKDIR "/home/user/libcanard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Utility to use local user, taken from: | ||
# https://github.com/mavlink/MAVSDK/blob/main/docker/entrypoint.sh | ||
|
||
# Use LOCAL_USER_ID if passed in at runtime. | ||
|
||
if [ -n "${LOCAL_USER_ID}" ]; then | ||
echo "Starting with UID: $LOCAL_USER_ID" | ||
usermod -u $LOCAL_USER_ID user | ||
export HOME=/home/user | ||
chown -R user:user $HOME | ||
|
||
exec su-exec user "$@" | ||
else | ||
exec "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
|
||
dockerimage=libcanard | ||
|
||
docker run -it --rm -v $(pwd):/home/user/libcanard:z -e LOCAL_USER_ID=`id -u` $dockerimage "$@" |