feat: add docker build support
Some checks reported errors
gitea-sync/antos/pipeline/head This commit looks good
gitea-sync/antos/pipeline/tag Something is wrong with the build of this commit

This commit is contained in:
DanyLE
2024-03-10 23:10:05 +01:00
parent 8ef0a5b7db
commit 43347010a8
7 changed files with 112 additions and 38 deletions

View File

@@ -1,13 +1,11 @@
FROM debian:bookworm AS deploy-env
ARG tag
COPY deps/ /
RUN apt-get update && apt-get --yes --no-install-recommends install libsqlite3-0 zlib1g libreadline8 wget libssl3 libvncclient1 libturbojpeg0 openssh-client tar tree
RUN apt clean && rm -rf /var/lib/apt/lists/*
RUN mkdir /ulib
RUN cp -rf /lib/*-linux-*/libsqlite3*.so* /ulib
RUN cp -rf /lib/*-linux-*/libreadline*.so* /ulib
RUN cp -rf /lib/*-linux-*/libncurse*.so* /ulib
# RUN cp -rf /lib/*-linux-*/libncurse*.so* /ulib
RUN cp -rf /lib/*-linux-*/libz*.so* /ulib
RUN cp -rf /lib/*-linux-*/libcrypt*.so* /ulib
RUN cp -rf /lib/*-linux-*/libdl*.so* /ulib
@@ -50,14 +48,10 @@ RUN cp -rf /lib/*-linux-*/libcom_err*.so* /ulib
RUN cp -rf /lib/*-linux-*/libkrb5support*.so* /ulib
RUN cp -rf /lib/*-linux-*/libkeyutils*.so* /ulib
# antos
RUN mkdir /build
COPY build/ /build/
RUN mkdir /platform
COPY antos-release/ /
RUN tar -xzf /build/$tag/AntOS_$(uname -m).tar.gz -C /platform/
RUN chown -R root:root /platform
RUN tree /platform
RUN ls -al /platform
RUN cp -rf /build/$(uname -m)/* /platform/
FROM busybox:1.36.1-glibc
#copy all necessary libraries
@@ -66,18 +60,13 @@ COPY --from=deploy-env /bin/wget /bin/
COPY --from=deploy-env /usr/bin/ssh /bin/
COPY --from=deploy-env /usr/bin/ssh-keygen /bin/
COPY --from=deploy-env /usr/bin/ssh-copy-id /bin/
COPY bash /bin/bash
COPY profile /etc/profile
RUN chmod a+x /bin/bash
# copy backend
COPY --from=deploy-env /platform/ /
# copy frontend
COPY antd-config.ini /opt/www/antd-config.ini
COPY runner.ini /opt/www/runner.ini
RUN chmod 744 /opt/www/antd-config.ini
RUN chmod 744 /opt/www/runner.ini
COPY docker/antos/profile /etc/profile
COPY --from=deploy-env /platform/opt/ /lib/opt/
COPY start.sh /start.sh
COPY docker/antos/start.sh /start.sh
RUN chmod 700 /start.sh
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/www/lib/"
ENV PATH="$PATH:/opt/www/bin/"
# start the entry point
ENTRYPOINT /start.sh

23
docker/antos/profile Normal file
View File

@@ -0,0 +1,23 @@
# unset variable if exists
unset ANTOS_USER
unset ANTOS_PASSWORD
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
# set user private LIB search path
if [ -d "$HOME/lib" ] ; then
export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
fi
# set user private LIB search path
if [ -d "$HOME/.local/lib" ] ; then
export LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH"
fi

21
docker/antos/start.sh Normal file
View File

@@ -0,0 +1,21 @@
#! /bin/sh
if [ -f "/file.fs" ]; then
mount /file.fs /home
fi
if [ -n "$ANTOS_USER" ]; then
adduser --home "/home/$ANTOS_USER" --disabled-password --gecos "" "$ANTOS_USER"
echo "$ANTOS_USER:$ANTOS_PASSWORD" | /bin/chpasswd
fi
unset ANTOS_USER
unset ANTOS_PASSWORD
# start syslog
syslogd -O /tmp/message
antd /opt/www/etc/antd-config.ini &
sleep 2
runner /opt/www/etc/runner.ini &
cat