mirror of
https://github.com/antos-rde/antos.git
synced 2024-12-28 14:38:21 +01:00
feat: add docker build support
This commit is contained in:
parent
8ef0a5b7db
commit
43347010a8
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
@ -79,6 +79,22 @@ pipeline {
|
|||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Build docker') {
|
||||||
|
agent {
|
||||||
|
node { label'workstation' }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
if (env.TAG_NAME) {
|
||||||
|
sh'''
|
||||||
|
DOCKER_TAG=$TAG_NAME DOCKER_IMAGE=iohubdev/antos make docker
|
||||||
|
'''
|
||||||
|
} else {
|
||||||
|
echo "Regular commit doing nothing"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Archive') {
|
stage('Archive') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
55
Makefile
55
Makefile
@ -1,13 +1,16 @@
|
|||||||
|
|
||||||
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
TAG:=$(subst master,stable,$(subst refs/heads/,,$(shell git symbolic-ref -q HEAD)))
|
DOCKER_TAG?=$(subst master,stable,$(subst refs/heads/,,$(shell git symbolic-ref -q HEAD)))
|
||||||
|
|
||||||
|
DOCKER_IMAGE?=iohubdev/antos
|
||||||
|
|
||||||
ARCH?=amd64
|
ARCH?=amd64
|
||||||
VERSION?=2.0.0-b
|
VERSION?=2.0.0-b
|
||||||
|
|
||||||
RUSTUP_HOME?=/opt/rust
|
RUSTUP_HOME?=/opt/rust
|
||||||
CARGO_HOME?=/opt/rust/cargo
|
CARGO_HOME?=/opt/rust/cargo
|
||||||
DESTDIR?=$(ROOT_DIR)/build/
|
BUILDDIR?=$(ROOT_DIR)/build/
|
||||||
|
DESTDIR?=/
|
||||||
|
|
||||||
ifeq ('$(ARCH)','amd64')
|
ifeq ('$(ARCH)','amd64')
|
||||||
RUST_TARGET?=x86_64-unknown-linux-gnu
|
RUST_TARGET?=x86_64-unknown-linux-gnu
|
||||||
@ -30,7 +33,7 @@ endif
|
|||||||
CC:=$(CC_PREFIX)gcc
|
CC:=$(CC_PREFIX)gcc
|
||||||
CXX:=$(CC_PREFIX)g++
|
CXX:=$(CC_PREFIX)g++
|
||||||
BUILD_PREFIX:=/opt/www
|
BUILD_PREFIX:=/opt/www
|
||||||
INSTALL_DIR:=$(DESTDIR)/$(ARCH)/$(BUILD_PREFIX)
|
INSTALL_DIR:=$(BUILDDIR)/$(ARCH)/$(BUILD_PREFIX)
|
||||||
|
|
||||||
BUILDID:=$(shell git rev-parse --short HEAD)
|
BUILDID:=$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
@ -51,7 +54,7 @@ antd: httpd plugins luasec luasocket silk luafcgi
|
|||||||
httpd: clean_c
|
httpd: clean_c
|
||||||
cd $(ROOT_DIR)/antd/ant-http && libtoolize && aclocal && autoconf && automake --add-missing
|
cd $(ROOT_DIR)/antd/ant-http && libtoolize && aclocal && autoconf && automake --add-missing
|
||||||
cd $(ROOT_DIR)/antd/ant-http && ./configure $(HOST) --prefix=$(BUILD_PREFIX)
|
cd $(ROOT_DIR)/antd/ant-http && ./configure $(HOST) --prefix=$(BUILD_PREFIX)
|
||||||
DESTDIR=$(DESTDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/ant-http install
|
DESTDIR=$(BUILDDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/ant-http install
|
||||||
|
|
||||||
plugins: antd-fcgi-plugin antd-tunnel-plugin antd-wvnc-plugin antd-tunnel-publishers
|
plugins: antd-fcgi-plugin antd-tunnel-plugin antd-wvnc-plugin antd-tunnel-publishers
|
||||||
@echo "Finish making plugins"
|
@echo "Finish making plugins"
|
||||||
@ -66,7 +69,7 @@ luasec: clean_c
|
|||||||
make -C $(ROOT_DIR)/antd/luasec linux
|
make -C $(ROOT_DIR)/antd/luasec linux
|
||||||
CC=$(CC) \
|
CC=$(CC) \
|
||||||
INC_PATH=-I$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
INC_PATH=-I$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
DESTDIR=$(DESTDIR)/$(ARCH) \
|
DESTDIR=$(BUILDDIR)/$(ARCH) \
|
||||||
LUAPATH=/opt/www/lib/lua \
|
LUAPATH=/opt/www/lib/lua \
|
||||||
LUACPATH=/opt/www/lib/lua \
|
LUACPATH=/opt/www/lib/lua \
|
||||||
make -C $(ROOT_DIR)/antd/luasec install
|
make -C $(ROOT_DIR)/antd/luasec install
|
||||||
@ -88,7 +91,7 @@ luasocket: clean_c
|
|||||||
LUAINC_linux=$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
LUAINC_linux=$(ROOT_DIR)/antd/silk/modules/lua/lua54/ \
|
||||||
LUAPREFIX_linux=$(BUILD_PREFIX) \
|
LUAPREFIX_linux=$(BUILD_PREFIX) \
|
||||||
PLAT=linux \
|
PLAT=linux \
|
||||||
DESTDIR=$(DESTDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/luasocket install-unix
|
DESTDIR=$(BUILDDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/luasocket install-unix
|
||||||
-mkdir -p $(INSTALL_DIR)/lib/lua
|
-mkdir -p $(INSTALL_DIR)/lib/lua
|
||||||
cp -rf $(INSTALL_DIR)/lib/lua/5.4/* $(INSTALL_DIR)/lib/lua/
|
cp -rf $(INSTALL_DIR)/lib/lua/5.4/* $(INSTALL_DIR)/lib/lua/
|
||||||
cp -rf $(INSTALL_DIR)/share/lua/5.4/* $(INSTALL_DIR)/lib/lua/
|
cp -rf $(INSTALL_DIR)/share/lua/5.4/* $(INSTALL_DIR)/lib/lua/
|
||||||
@ -99,7 +102,7 @@ antd-% sil%: clean_c
|
|||||||
cd $(ROOT_DIR)/antd/$@ && libtoolize && aclocal && autoconf && automake --add-missing
|
cd $(ROOT_DIR)/antd/$@ && libtoolize && aclocal && autoconf && automake --add-missing
|
||||||
cd $(ROOT_DIR)/antd/$@ && CFLAGS="-I$(INSTALL_DIR)/include" LDFLAGS="-L$(INSTALL_DIR)/lib" \
|
cd $(ROOT_DIR)/antd/$@ && CFLAGS="-I$(INSTALL_DIR)/include" LDFLAGS="-L$(INSTALL_DIR)/lib" \
|
||||||
./configure $(HOST) --prefix=$(BUILD_PREFIX)
|
./configure $(HOST) --prefix=$(BUILD_PREFIX)
|
||||||
DESTDIR=$(DESTDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/$@ install
|
DESTDIR=$(BUILDDIR)/$(ARCH) make -C $(ROOT_DIR)/antd/$@ install
|
||||||
|
|
||||||
luafcgi:
|
luafcgi:
|
||||||
ifeq ($(LUAFCGI_IGNORE),)
|
ifeq ($(LUAFCGI_IGNORE),)
|
||||||
@ -128,6 +131,16 @@ clean_c:
|
|||||||
-make -C antd/luasocket clean
|
-make -C antd/luasocket clean
|
||||||
-make -C antd/silk clean
|
-make -C antd/silk clean
|
||||||
|
|
||||||
|
install:
|
||||||
|
cd $(INSTALL_DIR) && find . -type f,l \
|
||||||
|
-exec install -Dm 755 "{}" "$(DESTDIR)/$(BUILD_PREFIX)/{}" \;
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
cd $(INSTALL_DIR) && find . -type f,l \
|
||||||
|
-exec rm "$(DESTDIR)/$(BUILD_PREFIX)/{}" \;
|
||||||
|
find $(DESTDIR)/$(BUILD_PREFIX) -type d -empty -delete
|
||||||
|
|
||||||
|
|
||||||
clean: clean_c
|
clean: clean_c
|
||||||
@echo "Clean Rust project and output DIR"
|
@echo "Clean Rust project and output DIR"
|
||||||
RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
|
RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
|
||||||
@ -136,7 +149,7 @@ clean: clean_c
|
|||||||
cargo clean \
|
cargo clean \
|
||||||
--manifest-path=$(ROOT_DIR)/antd/luafcgi/Cargo.toml \
|
--manifest-path=$(ROOT_DIR)/antd/luafcgi/Cargo.toml \
|
||||||
--config=$(ROOT_DIR)/antd/luafcgi/.cargo/config.toml
|
--config=$(ROOT_DIR)/antd/luafcgi/.cargo/config.toml
|
||||||
-rm -rf $(DESTDIR)/*
|
-rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
@echo "Building $@"
|
@echo "Building $@"
|
||||||
@ -153,15 +166,27 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
deb:
|
deb:
|
||||||
-rm $(DESTDIR)/$(ARCH)/*.deb
|
-rm $(BUILDDIR)/$(ARCH)/*.deb
|
||||||
scripts/mkdeb.sh $(VERSION_STR) $(ARCH) $(DESTDIR)/$(ARCH)
|
scripts/mkdeb.sh $(VERSION_STR) $(ARCH) $(BUILDDIR)/$(ARCH)
|
||||||
|
|
||||||
tar.gz: antos
|
tar.gz: antos
|
||||||
-rm $(DESTDIR)/$(ARCH)/$(PKG_NAME).tar.gz
|
-rm $(BUILDDIR)/$(ARCH)/$(PKG_NAME).tar.gz
|
||||||
cd $(DESTDIR)/$(ARCH)/ && tar cvzf $(PKG_NAME).tar.gz opt
|
cd $(BUILDDIR)/$(ARCH)/ && tar cvzf $(PKG_NAME).tar.gz opt
|
||||||
|
|
||||||
appimg:
|
appimg:
|
||||||
-rm $(DESTDIR)/$(ARCH)/*.AppImage
|
-rm $(BUILDDIR)/$(ARCH)/*.AppImage
|
||||||
scripts/mkappimg.sh $(ARCH) $(VERSION_STR) $(DESTDIR)/$(ARCH) $(ROOT_DIR)/antos-64.png
|
scripts/mkappimg.sh $(ARCH) $(VERSION_STR) $(BUILDDIR)/$(ARCH) $(ROOT_DIR)/antos-64.png
|
||||||
|
|
||||||
.PHONY: antd antos
|
docker:
|
||||||
|
ln -sfn arm $(BUILDDIR)/armv7l
|
||||||
|
ln -sfn arm64 $(BUILDDIR)/aarch64
|
||||||
|
ln -sfn amd64 $(BUILDDIR)/x86_64
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
|
||||||
|
--tag $(DOCKER_IMAGE):$(DOCKER_TAG) \
|
||||||
|
-f docker/antos/Dockerfile \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
rm $(BUILDDIR)/aarch64 $(BUILDDIR)/armv7l $(BUILDDIR)/x86_64
|
||||||
|
# --push
|
||||||
|
.PHONY: antd antos docker
|
@ -1 +1 @@
|
|||||||
Subproject commit 426ccca40447c366014104fd799f7a0efbb5de97
|
Subproject commit dd1ceec9965b2c9582ffa3a60419215c7eff0a98
|
@ -1 +1 @@
|
|||||||
Subproject commit 32bd62ae865bfe730e940ca02fdebd92b8ab7090
|
Subproject commit 37f68f0e04aadf3e829eab7e6a6fe569e2e3032a
|
@ -1,13 +1,11 @@
|
|||||||
FROM debian:bookworm AS deploy-env
|
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-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 apt clean && rm -rf /var/lib/apt/lists/*
|
||||||
RUN mkdir /ulib
|
RUN mkdir /ulib
|
||||||
RUN cp -rf /lib/*-linux-*/libsqlite3*.so* /ulib
|
RUN cp -rf /lib/*-linux-*/libsqlite3*.so* /ulib
|
||||||
RUN cp -rf /lib/*-linux-*/libreadline*.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-*/libz*.so* /ulib
|
||||||
RUN cp -rf /lib/*-linux-*/libcrypt*.so* /ulib
|
RUN cp -rf /lib/*-linux-*/libcrypt*.so* /ulib
|
||||||
RUN cp -rf /lib/*-linux-*/libdl*.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-*/libkrb5support*.so* /ulib
|
||||||
RUN cp -rf /lib/*-linux-*/libkeyutils*.so* /ulib
|
RUN cp -rf /lib/*-linux-*/libkeyutils*.so* /ulib
|
||||||
|
|
||||||
|
RUN mkdir /build
|
||||||
# antos
|
COPY build/ /build/
|
||||||
RUN mkdir /platform
|
RUN mkdir /platform
|
||||||
COPY antos-release/ /
|
RUN cp -rf /build/$(uname -m)/* /platform/
|
||||||
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
|
|
||||||
|
|
||||||
FROM busybox:1.36.1-glibc
|
FROM busybox:1.36.1-glibc
|
||||||
#copy all necessary libraries
|
#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 /bin/
|
||||||
COPY --from=deploy-env /usr/bin/ssh-keygen /bin/
|
COPY --from=deploy-env /usr/bin/ssh-keygen /bin/
|
||||||
COPY --from=deploy-env /usr/bin/ssh-copy-id /bin/
|
COPY --from=deploy-env /usr/bin/ssh-copy-id /bin/
|
||||||
COPY bash /bin/bash
|
COPY docker/antos/profile /etc/profile
|
||||||
COPY profile /etc/profile
|
COPY --from=deploy-env /platform/opt/ /lib/opt/
|
||||||
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 start.sh /start.sh
|
COPY docker/antos/start.sh /start.sh
|
||||||
RUN chmod 700 /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
|
# start the entry point
|
||||||
ENTRYPOINT /start.sh
|
ENTRYPOINT /start.sh
|
||||||
|
23
docker/antos/profile
Normal file
23
docker/antos/profile
Normal 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
21
docker/antos/start.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user