Files
iopsyswrt/Dockerfile
Andreas Gnau 749cc55d0b Dockerfile: Add python3-requests
python3-requests is needed for some CI scripts hosted outside of this
repo. Add it to Dockerfile explicitly.

Fixes: 6a1fa7adb8 ("iop: Do not install recommended packages")
Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
2025-11-26 21:28:17 +01:00

84 lines
3.0 KiB
Docker

FROM debian:trixie-slim as build-python2
RUN apt-get -y update && \
apt-get install -y libreadline-dev libbz2-dev libsqlite3-dev libssl-dev build-essential wget && \
rm -rf /var/lib/apt/lists/* && \
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz && \
tar xf Python-2.7.18.tgz && \
cd Python-2.7.18 && \
./configure --prefix=/usr/local/python2.7 --enable-shared && \
make -j8 && \
make install && \
mkdir -p /usr/local/python2.7/DEBIAN
COPY docker/control-python2.7 /usr/local/python2.7/DEBIAN/control
RUN dpkg-deb --build /usr/local/python2.7 && \
rm -rf /Python-2.7.18.tgz Python-2.7.18
FROM debian:trixie-slim
# Install prerequisites for the "iop" script and some CI pipeline scripts
RUN dpkg --add-architecture i386 && \
apt-get -y update && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install --no-install-recommends \
locales \
sudo \
wget \
curl \
ca-certificates \
gnupg \
python3-mako \
python3-requests \
python3-yaml && \
rm -rf /var/lib/apt/lists/*
# Set the same PATH varialbe for root and non-root users
RUN echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" && export PATH" >> /etc/profile
# Install Node.js
ARG NODEJS_VERSION_MAJOR=20
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODEJS_VERSION_MAJOR}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
apt-get -y update && \
apt-get install -y nodejs && \
npm install --global typescript yarn && \
rm -rf /var/lib/apt/lists/*
# 1. Create new unprivileged user "dev"
# 2. Install fixuid to accomodate for the host machine UID/GID
ARG FIXUID_VERSION=0.5.1
RUN useradd -m -s /bin/bash dev && \
curl -fsSL "https://github.com/boxboat/fixuid/releases/download/v${FIXUID_VERSION}/fixuid-${FIXUID_VERSION}-linux-amd64.tar.gz" | tar -C /usr/local/bin -xzf -
# Copy fixuid configuration
COPY docker/fixuid.yml /etc/fixuid/config.yml
# Copy git configuration to dev's home folder
COPY --chown=dev:dev docker/gitconfig /home/dev/.gitconfig
# Install python2
COPY --from=build-python2 /usr/local/python2.7.deb /tmp/
RUN dpkg -i /tmp/python2.7.deb && rm /tmp/python2.7.deb
# Run "iop setup_host" inside image to install necessary SDK dependencies
COPY iop /
RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections && \
ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
yes | /iop setup_host && \
rm /iop && \
rm -rf /var/lib/apt/lists/*
RUN echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/10-dev
ENTRYPOINT ["/usr/local/bin/fixuid", "-q"]
CMD ["bash"]
RUN mkdir -p /home/dev/iopsyswrt /home/dev/.ssh \
&& chown -R dev:dev /home/dev
USER dev:dev
WORKDIR /home/dev/iopsyswrt
VOLUME ["/home/dev/iopsyswrt"]