Skip to content
Open
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
82 changes: 82 additions & 0 deletions docker/Dockerfile.trixie
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
FROM debian:trixie
ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS yes

ARG uid
ARG http_proxy
ARG https_proxy
ARG no_proxy

RUN apt-get update --fix-missing && apt-get -y upgrade --fix-missing

RUN apt-get install --fix-missing -y \
binfmt-support \
bubblewrap \
debootstrap \
dosfstools \
dpkg-dev \
gettext-base \
git \
mtools \
parted \
python3 \
quilt \
qemu-system-x86 \
qemu-system-arm \
qemu-user-static \
seabios \
reprepro \
sudo \
git-buildpackage \
pristine-tar \
sbuild \
schroot \
zstd \
python3-setuptools \
python3-yaml \
python3-html5lib \
python3-pip \
vim \
screen \
socat \
patchelf \
sqlite3 \
umoci \
skopeo \
mmdebstrap \
locales

RUN useradd -s /bin/bash -m build -u $uid
RUN gpasswd -a build sbuild
RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers
RUN echo "Defaults env_keep += \" http_proxy https_proxy no_proxy\"" | tee -a /etc/sudoers

# Fix error "Please use a locale setting which supports utf-8."
# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales 2>/dev/null && \
update-locale LANG=en_US.UTF-8

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

ADD gitproxy /usr/bin
RUN chmod +x /usr/bin/gitproxy

USER build
WORKDIR /home/build

RUN bash -c 'if test -n "$http_proxy"; then git config --global http.proxy "$http_proxy"; \
git config --global core.gitproxy "/usr/bin/gitproxy"; fi'
RUN bash -c 'if test -n "$https_proxy"; then git config --global https.proxy "$https_proxy"; fi'
RUN bash -c 'if test -n "$no_proxy"; then git config --global core.noproxy "$no_proxy"; fi'

RUN pip install --user 'cyclonedx-python-lib>=7.3.2,<=7.5.1' --break-system-packages --no-warn-script-location
RUN pip install --user jsonschema==4.21.1 --break-system-packages --no-warn-script-location
RUN pip install --user spdx-tools==0.8.2 --break-system-packages --no-warn-script-location
RUN pip install --user looseversion==1.3.0 --break-system-packages --no-warn-script-location

RUN mkdir work
WORKDIR /home/build/work
56 changes: 34 additions & 22 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
version: '3.8'

x-build-args: &build-args
context: .
args:
uid: $host_user_id
http_proxy: $http_proxy
https_proxy: $https_proxy
ftp_proxy: $ftp_proxy
no_proxy: $no_proxy

x-base-config: &base-config
environment:
- http_proxy=$http_proxy
- https_proxy=$https_proxy
- ftp_proxy=$ftp_proxy
- no_proxy=$no_proxy
volumes:
- /dev/shm:/dev/shm:rw
- ../../../:/home/build/work:rw
devices:
- /dev/net/tun:/dev/net/tun
privileged: true
cap_add:
- NET_ADMIN
user: build
command: /bin/sh -c "sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc && /bin/bash"

services:
emlinux3-build:
<<: *base-config
image: "emlinux3-build-${host_user_name}"
build:
context: .
<<: *build-args
dockerfile: Dockerfile
args:
uid: $host_user_id
http_proxy: $http_proxy
https_proxy: $https_proxy
ftp_proxy: $ftp_proxy
no_proxy: $no_proxy
environment:
- http_proxy=$http_proxy
- https_proxy=$https_proxy
- ftp_proxy=$ftp_proxy
- no_proxy=$no_proxy
volumes:
- /dev/shm:/dev/shm:rw
- ../../../:/home/build/work:rw
devices:
- /dev/net/tun:/dev/net/tun
privileged: true
cap_add:
- NET_ADMIN
user: build
command: /bin/sh -c "sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc && /bin/bash"

emlinux3-build-trixie:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both service have lots of common setting, so please make common setting section using anchors .

e.g.

version: '3.8'

x-build-args: &build-args
  context: .
  args:
    uid: $host_user_id
    http_proxy: $http_proxy
    https_proxy: $https_proxy
    ftp_proxy: $ftp_proxy
    no_proxy: $no_proxy

x-base-config: &base-config
  environment:
    - http_proxy=$http_proxy
    - https_proxy=$https_proxy
    - ftp_proxy=$ftp_proxy
    - no_proxy=$no_proxy
  volumes:
    - /dev/shm:/dev/shm:rw
    - ../../../:/home/build/work:rw
  devices:
    - /dev/net/tun:/dev/net/tun
  privileged: true
  cap_add:
    - NET_ADMIN
  user: build
  command: /bin/sh -c "sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc && /bin/bash"

services:
  emlinux3-build:
    <<: *base-config
    image: "emlinux3-build-${host_user_name}"
    build:
      <<: *build-args
      dockerfile: Dockerfile

  emlinux3-build-trixie:
    <<: *base-config
    image: "emlinux3-build-trixie-${host_user_name}"
    build:
      <<: *build-args
      dockerfile: Dockerfile.trixie

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added new commit for your comment.

<<: *base-config
image: "emlinux3-build-trixie-${host_user_name}"
build:
<<: *build-args
dockerfile: Dockerfile.trixie
27 changes: 21 additions & 6 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,24 @@ if [ $? != 0 ]; then
fi

mode="run"
if [ $# = 1 ]; then
mode="${1}"
fi
while [ $# -gt 0 ]; do
case "$1" in
run|build|clean)
mode="$1"
;;
"-t")
distro="-trixie"
;;
"-h")
echo "Usage: $0 [-t] [run|build|clean]"
echo " -t: Use trixie distribution (Default is bookworm)"
echo " run: Run new docker container"
echo " build: Build docker image"
echo " clean: Remove docker image"
exit
esac
shift
done

host_user_id=$(id -u)
host_user_name=$(id -un)
Expand All @@ -25,9 +40,9 @@ export host_user_name="${host_user_name}"

cd ${script_dir}
if [ "${mode}" = "build" ]; then
${docker_compose_cmd} build --no-cache emlinux3-build
${docker_compose_cmd} build --no-cache emlinux3-build"${distro}"
elif [ "${mode}" = "run" ]; then
${docker_compose_cmd} run --rm emlinux3-build
${docker_compose_cmd} run --rm emlinux3-build"${distro}"
elif [ "${mode}" = "clean" ]; then
docker rmi -f "emlinux3-build-${host_user_name}"
docker rmi -f "emlinux3-build${distro}-${host_user_name}"
fi