-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (45 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
56 lines (45 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Start from the Debian Sid base image
FROM debian:sid
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
# Allow passing user info from host
ARG USERNAME
ARG USER_UID
ARG USER_GID
# Default to 'developer' if not provided
ENV USERNAME=${USERNAME:-developer}
ENV USER_UID=${USER_UID:-1000}
ENV USER_GID=${USER_GID:-1000}
# Update apt and install build dependencies for MRPT
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
wget \
lsb-release \
sudo \
software-properties-common \
git-buildpackage && \
rm -rf /var/lib/apt/lists/*
# Add the source line to the sources.list
RUN echo "deb-src https://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list && \
apt-get update && \
apt-get build-dep -y mrpt && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Create the same user as on the host
RUN groupadd --gid ${USER_GID} ${USERNAME} && \
useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME}
# Set work directory
WORKDIR /tmp/mrpt_build
# Use the new user
USER ${USERNAME}
ENV HOME=/home/${USERNAME}
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
# Optional: Preconfigure git defaults (useful if .gitconfig isn’t mounted)
RUN git config --global user.name "${USERNAME}" && \
git config --global user.email "${USERNAME}@example.com"
# Define mount points (generic)
# These don't hardcode host paths but define mountable dirs
VOLUME ["/tmp/mrpt_build", "/home/${USERNAME}/.gitconfig", "/home/${USERNAME}/.ssh"]
CMD ["/bin/bash"]