Improved yocto directory structure
This commit is contained in:
@@ -42,9 +42,15 @@ ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
# Create non-root user for Yocto builds (Yocto doesn't like running as root)
|
||||
RUN useradd -m -s /bin/bash yocto && \
|
||||
echo "yocto ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
# Create build user matching host UID/GID
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
RUN groupadd -g ${GROUP_ID} builder && \
|
||||
useradd -u ${USER_ID} -g ${GROUP_ID} -ms /bin/bash builder
|
||||
|
||||
# Enable compiler cache for performance
|
||||
ENV USE_CCACHE=1
|
||||
ENV CCACHE_DIR=/workspace/.ccache
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspace
|
||||
@@ -53,11 +59,7 @@ WORKDIR /workspace
|
||||
RUN chown -R yocto:yocto /workspace
|
||||
|
||||
# Switch to yocto user
|
||||
USER yocto
|
||||
|
||||
# Set up git configuration (required for Yocto)
|
||||
RUN git config --global user.name "Yocto Builder" && \
|
||||
git config --global user.email "yocto@builder.local"
|
||||
USER builder
|
||||
|
||||
# Default command to start interactive shell
|
||||
CMD ["/bin/bash"]
|
||||
Reference in New Issue
Block a user