Dockerfile update and some files restructure

This commit is contained in:
George Sokianos 2024-01-18 11:47:48 +00:00
parent 4df4e94a7c
commit bb48f7c36c
3 changed files with 96 additions and 43 deletions

View File

@ -1,38 +1,37 @@
FROM walkero/lha-on-docker as lha-image
# The ubuntu:latest tag points to the "latest LTS", since that's the version recommended for general use.
FROM ubuntu:latest
FROM alpine/git:2.40.1 AS git-clone
LABEL maintainer="Georgios Sokianos <walkero@gmail.com>"
RUN mkdir /repos; \
# git clone https://github.com/sba1/adtools /repos/adtools --depth 1; \
git clone https://github.com/AmigaLabs/adtools.git /repos/adtools --depth 1; \
git clone https://github.com/bminor/binutils-gdb /repos/binutils-gdb; \
git clone https://github.com/coreutils/coreutils /repos/coreutils; \
git clone https://github.com/coreutils/gnulib /repos/gnulib
ARG DEBIAN_FRONTEND=noninteractive
ARG REPOS_PATH
ARG CLIB2_REPO
COPY --from=lha-image /usr/bin/lha /usr/bin/lha
WORKDIR /tmp
FROM ubuntu:latest AS builder
RUN dpkg --add-architecture i386 && apt-get update && apt-get -y --no-install-recommends install \
ca-certificates \
curl \
python2.7;
ENV AMIDEV_USER_ID=1000 \
AMIDEV_GROUP_ID=1000 \
PATH="/home/amidev/.local/bin:$PATH"
RUN ln -s /usr/bin/python2.7 /usr/bin/python; \
curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o /tmp/get-pip.py && \
python get-pip.py && \
pip2 install --no-cache-dir argcomplete==1.12.3 mako; \
rm -rf /tmp/* /var/tmp/*;
COPY --from=walkero/lha-on-docker /usr/bin/lha /usr/bin/lha
RUN apt-get -y --no-install-recommends install \
ENV PACKAGES="\
autoconf \
automake \
autopoint \
bison \
bzip2 \
ca-certificates \
curl \
dh-autoreconf \
flex \
g++-8 \
g++-10 \
gettext \
git \
gperf \
gpg \
libfl2 \
libgmp-dev \
libmpc3 \
libmpc-dev \
@ -41,29 +40,48 @@ RUN apt-get -y --no-install-recommends install \
mc \
nano \
patch \
python3 \
rsync \
texinfo \
wdiff \
wget \
xz-utils; \
ln -s /usr/bin/g++-8 /usr/bin/g++; \
xz-utils"
RUN apt-get update && \
apt-get -y --no-install-recommends install ${PACKAGES}; \
ln -s /usr/bin/g++-10 /usr/bin/g++; \
rm /usr/bin/gcc; \
ln -s /usr/bin/gcc-8 /usr/bin/gcc; \
git config --global user.email "walkero@gmail.com"; \
git config --global user.name "Georgios Sokianos";
ln -s /usr/bin/gcc-10 /usr/bin/gcc; \
\
ln -s /usr/bin/python3 /usr/bin/python; \
curl -fsSL https://bootstrap.pypa.io/pip/get-pip.py -o /tmp/get-pip.py && \
python /tmp/get-pip.py && \
pip3 install --no-cache-dir mako;
# Add necessary repos
ADD ${REPOS_PATH}/adtools /opt/adtools
ADD ${REPOS_PATH}/binutils-gdb /opt/adtools/binutils/repo
ADD ${REPOS_PATH}/coreutils /opt/adtools/coreutils/repo
ADD ${REPOS_PATH}/gnulib /opt/adtools/gnulib/repo
ADD build-gcc.sh /opt/adtools
ADD ${REPOS_PATH}/execsg_private_sdk /tmp/execsg_private_sdk
ADD ${REPOS_PATH}/newlib-53.77 /tmp/newlib
# Copy necessary repos from git-clone
COPY --from=git-clone /repos/adtools /opt/adtools
COPY --from=git-clone /repos/binutils-gdb /opt/adtools/binutils/repo
COPY --from=git-clone /repos/coreutils /opt/adtools/coreutils/repo
COPY --from=git-clone /repos/gnulib /opt/adtools/gnulib/repo
COPY ./scripts/build-gcc.sh /opt/adtools
COPY ./scripts/setup-user.sh /setup-user.sh
COPY ./files/gcc-build/Makefile /opt/adtools/gcc-build/
WORKDIR /opt/adtools
RUN git submodule init && \
git submodule update && \
chmod +x build-gcc.sh
RUN chmod +x /setup-user.sh ./build-gcc.sh; \
bash /setup-user.sh && rm /setup-user.sh; \
chown ${AMIDEV_USER_ID}:${AMIDEV_GROUP_ID} /opt -R;
# USER amidev
RUN git config --global --add safe.directory /opt/adtools; \
git config --global --add safe.directory /opt/adtools/binutils/repo; \
git config --global --add safe.directory /opt/adtools/coreutils/repo; \
git config --global --add safe.directory /opt/adtools/gnulib/repo; \
git config --global user.email "walkero@gmail.com"; \
git config --global user.name "Georgios Sokianos"; \
git submodule init && \
git submodule update;
# USER root

View File

@ -1,9 +1,9 @@
#!/bin/bash
# This script compiles the native GCC environment
gild/bin/gild checkout binutils ${BINUTILS_VER} && \
gild/bin/gild checkout gcc ${GCC_VER} && \
make -C native-build SDK_VERSION=53.34 CLIB2_REPO=afxgroup -j4
gild/bin/gild checkout binutils ${BINUTILS_VER}
gild/bin/gild checkout gcc ${GCC_VER}
make -C native-build -j4
# Prepare coreutils 5.2 (disabled)
gild/bin/gild checkout coreutils 5.2
@ -21,6 +21,7 @@ cd /opt/adtools/native-build
# The following might fail on [ and need to run twice
make native-install
make native-dist SDK_VERSION=53.34 CLIB2_REPO=afxgroup && \
make clib2-dist && \
make native-dist
make clib2-dist
make clib4-dist
mv adtools-os4-*.lha /gcc

34
scripts/setup-user.sh Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/bash
existing_group=$(getent group "$AMIDEV_GROUP_ID" | cut -d: -f1);
if [[ -n "$existing_group" ]]; then
delgroup "$existing_group"
fi
existing_user=$(getent passwd "$AMIDEV_USER_ID" | cut -d: -f1);
if [[ -n "$existing_user" ]]; then
deluser "$existing_user"
fi
addgroup --gid $AMIDEV_GROUP_ID amidev
adduser --system --uid $AMIDEV_USER_ID --disabled-password --shell /bin/bash --gid $AMIDEV_GROUP_ID amidev
sed -i '/^amidev/s/!/*/' /etc/shadow;
BASHFILE=/home/amidev/.bashrc
cp ~/.bashrc /home/amidev/
chown amidev:amidev $BASHFILE
sed -i '4c\'"\nparse_git_branch() {\n\
git branch 2> /dev/null | sed -e \'/^[^*]/d\' -e \'s/* \\\(.*\\\)/ (\\\1)/\'\n\
}\n" $BASHFILE
sed -i '43c\'"force_color_prompt=yes" $BASHFILE
sed -i '57c\'" PS1=\'\${debian_chroot:+(\$debian_chroot)}\\\[\\\033[01;32m\\\]\\\u@\\\h\\\[\\\033[00m\\\]:\\\[\\\033[01;34m\\\]\\\w\\\[\\\033[01;31m\\\]\$(parse_git_branch)\\\[\\\033[00m\\\]\\\$ '" $BASHFILE
sed -i '59c\'" PS1=\'\${debian_chroot:+(\$debian_chroot)}\\\u@\\\h:\\\w \$(parse_git_branch)\$ \'" $BASHFILE
sed -i '3c\'"\nexport PATH=${PATH}\n" $BASHFILE