Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mimic host as much as possible #55

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ docker:
docker build \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
--build-arg USER=$(shell id -u -n) \
--build-arg GROUP=$(shell id -u -n) \
--build-arg HOME=$(HOME) \
docker -t tiiuae/build:latest

linux-image:
Expand Down
20 changes: 10 additions & 10 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ FROM debian:bullseye

ARG UID=1000
ARG GID=1000
ARG USER=build
ARG GROUP=build
ARG HOME=/home/build

# tzdata noninteractive install
ENV TZ=Europe/Helsinki
Expand Down Expand Up @@ -87,15 +90,16 @@ RUN \
g++-aarch64-linux-gnu

RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen
RUN useradd -m -d /home/build -s /bin/bash -G sudo -u $UID -g $GID build
RUN echo 'build:build' | chpasswd
RUN groupadd -g $GID $GROUP
RUN useradd -m -d $HOME -s /bin/bash -G sudo -u $UID -g $GID $USER
RUN passwd -d $USER
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN printf '\n\n\
eval $(ssh-agent -s &> /dev/null)\n\
find /home/build/.ssh/ -type f -exec grep -l "PRIVATE" {} \; | xargs ssh-add &> /dev/null\n'\
>> /home/build/.bashrc
RUN printf 'add-auto-load-safe-path /workspace/.gdbinit' >> /home/build/.gdbinit
USER build
find '$HOME'/.ssh/ -type f -exec grep -l "PRIVATE" {} \; | xargs ssh-add &> /dev/null\n'\
>> $HOME/.bashrc
RUN printf 'add-auto-load-safe-path /workspace/.gdbinit' >> $HOME/.gdbinit
USER $USER

RUN pip3 install \
aenum \
Expand All @@ -104,7 +108,3 @@ RUN pip3 install \
plyplus \
pyfdt \
pyyaml

ENV WORKSPACE=/workspace

WORKDIR /workspace
15 changes: 8 additions & 7 deletions docker/enter_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ fi
# shellcheck disable=SC2086
exec ${CONTAINER_ENGINE} run --rm ${INTERACTIVE} \
${CONTAINER_ENV_FLAGS} \
-v "${DIR}:/workspace:z" \
${YOCTO_SOURCE_MIRROR_DIR:+--env YOCTO_SOURCE_MIRROR_DIR=/workspace/downloads} \
${YOCTO_SOURCE_MIRROR_DIR:+-v "${YOCTO_SOURCE_MIRROR_DIR}":/workspace/downloads:z} \
${BUILD_CACHE_DIR:+--env BUILD_CACHE_DIR=/home/build/.stack} \
${BUILD_CACHE_DIR:+-v "${BUILD_CACHE_DIR}"/stack:/home/build/.stack:z} \
-v "${HOME}/.ssh:/home/build/.ssh:z" \
-v "${HOME}/.gitconfig:/home/build/.gitconfig:z" \
-w "${DIR}" \
-v "${DIR}:${DIR}:z" \
${YOCTO_SOURCE_MIRROR_DIR:+--env YOCTO_SOURCE_MIRROR_DIR="${DIR}"/downloads} \
${YOCTO_SOURCE_MIRROR_DIR:+-v "${YOCTO_SOURCE_MIRROR_DIR}":"${DIR}"/downloads:z} \
${BUILD_CACHE_DIR:+--env BUILD_CACHE_DIR="${HOME}"/.stack} \
${BUILD_CACHE_DIR:+-v "${BUILD_CACHE_DIR}"/stack:"${HOME}"/.stack:z} \
-v "${HOME}/.ssh:${HOME}/.ssh:z" \
-v "${HOME}/.gitconfig:${HOME}/.gitconfig:z" \
${CONTAINER_ENGINE_OPTS} \
"${CONTAINER_REGISTRY_PREFIX}tiiuae/build:latest" ${CMD}
Loading