update to antos version 1.2.0

This commit is contained in:
lxsang 2021-03-24 20:27:43 +01:00
parent a52bca082f
commit c7812b1c97
6 changed files with 113 additions and 130 deletions

View File

@ -1,12 +1,12 @@
FROM alpine AS build-env FROM alpine:3.9 AS build-env
RUN apk add build-base make sqlite-dev zlib-dev readline-dev nodejs npm RUN apk add build-base make sqlite-dev zlib-dev readline-dev nodejs npm openssl-dev
COPY download /download COPY download /download
RUN cd /download/antd-1.0.6b && ./configure --prefix=/usr/ --enable-debug=yes && make && make install RUN cd /download/antd-1.0.6b && ./configure --prefix=/usr/ && make && make install
RUN cd /download/lua-0.5.2b && ./configure --prefix=/opt/www --enable-debug=yes && make && make install RUN cd /download/lua-0.5.2b && ./configure --prefix=/opt/www && make && make install
RUN cd /download/wterm-1.0.0b && ./configure --prefix=/opt/www --enable-debug=yes && make && make install RUN cd /download/wterm-1.0.0b && ./configure --prefix=/opt/www && make && make install
RUN cd /download/tunnel-0.1.0b && ./configure --prefix=/opt/www --enable-debug=yes && make && make install RUN cd /download/tunnel-0.1.0b && ./configure --prefix=/opt/www && make && make install
RUN cd /download/antd-publishers-0.1.0a && ./configure --prefix=/opt/www --enable-debug=yes && make && make install RUN cd /download/antd-publishers-0.1.0a && ./configure --prefix=/opt/www && make && make install
RUN mkdir -p /opt/www/htdocs RUN mkdir -p /opt/www/htdocs
@ -14,13 +14,12 @@ RUN cd /download/antd-web-apps && BUILDDIR=/opt/www/htdocs PROJS=os make
RUN rm /opt/www/htdocs/index.ls RUN rm /opt/www/htdocs/index.ls
RUN cd /download/antos && npm install terser uglifycss typescript -g && npm install @types/jquery && BUILDDIR=/opt/www/htdocs/os make release RUN cd /download/antos && npm install terser uglifycss typescript -g && npm install @types/jquery && BUILDDIR=/opt/www/htdocs/os make release
FROM alpine FROM alpine:3.9
RUN apk add --no-cache sqlite-dev zlib readline-dev RUN apk add --no-cache sqlite-dev zlib readline openssl curl
COPY antd-config.ini /etc/antd-config.ini COPY start.sh /start.sh
COPY --from=build-env /usr/bin/antd /usr/bin/antd COPY --from=build-env /usr/bin/antd /usr/bin/antd
COPY --from=build-env /usr/lib/libantd* /usr/lib/ COPY --from=build-env /usr/lib/libantd* /usr/lib/
COPY --from=build-env /opt/www /opt/www COPY --from=build-env /opt/www /opt/www
RUN adduser --home /home/demo --disabled-password --gecos "" demo ENTRYPOINT /start.sh
RUN echo -e "demo\ndemo" | passwd demo # ENTRYPOINT /bin/sh
ENTRYPOINT LD_PRELOAD=/opt/www/lib/lua/core.so /usr/bin/antd /etc/antd-config.ini

View File

@ -22,18 +22,79 @@ sudo docker load < antosaio.tar
The image can be run in a container using The image can be run in a container using
```sh ```sh
sudo docker run -p 8080:80 -it antosaio
# app dir that will be mounted to the container
# the server configuration is stored in this location
mkdir -p /tmp/app/home
# create the server configuration
cat << EOF > /tmp/app/antd_config.ini
[SERVER]
plugins=/opt/www/lib/
plugins_ext=.so
database=/opt/www/database/
tmpdir=/opt/www/tmp/
maxcon=200
backlog=5000
workers = 4
max_upload_size = 10000000
gzip_enable = 1
gzip_types = text\/.*,.*\/css,.*\/json,.*\/javascript
[PORT:80]
htdocs=/opt/www/htdocs
ssl.enable=0
^/(.*)$ = /os/router.lua?r=<1>&<query>
[AUTOSTART]
plugin = tunnel
[MIMES]
image/bmp=bmp
image/jpeg=jpg,jpeg
text/css=css
text/markdown=md
text/csv=csv
application/pdf=pdf
image/gif=gif
text/html=html,htm,chtml
application/json=json
application/javascript=js
image/png=png
image/x-portable-pixmap=ppm
application/x-rar-compressed=rar
image/tiff=tiff
application/x-tar=tar
text/plain=txt
application/x-font-ttf=ttf
application/xhtml+xml=xhtml
application/xml=xml
application/zip=zip
image/svg+xml=svg
application/vnd.ms-fontobject=eot
application/x-font-woff=woff,woff2
application/x-font-otf=otf
audio/mpeg=mp3,mpeg
[FILEHANDLER]
lua = lua
EOF
docker run \
-p 8080:80 \
--mount type=bind,source=/tmp/app,target=/app \
-e ANTOS_USER=demo \
-e ANTOS_PASSWORD=demo \
-it antosaio
``` ```
Here we map the host port 8080 to the port 80 on the `antosaio` container. Here we map the host port 8080 to the port 80 on the `antosaio` container.
From the host browser, the VDE can be accessed via From the host browser, the VDE can be accessed via
``` ```
http://localhost:8080/os/ http://localhost:8080
``` ```
Note that: the `/` at the end of the URL is important.
### Build your own image ### Build your own image
It is really simple to build your own AntOS docker image: It is really simple to build your own AntOS docker image:

View File

@ -1,78 +0,0 @@
[SERVER]
; plugin directory
plugins=/opt/www/lib/
; plugin extension
plugins_ext=.so
; SQLITE database path
database=/opt/www/database/
; tmp dir
tmpdir=/opt/www/tmp/
; max concurent connection
maxcon=200
; server backlocg
backlog=5000
; number of workers
workers = 4
; max upload file size in bytes
max_upload_size = 10000000
; enable compression
gzip_enable = 1
gzip_types = text\/.*,.*\/css,.*\/json,.*\/javascript
; a configuration each port
[PORT:80]
htdocs=/opt/www/htdocs
; enable or disable SSL
ssl.enable=0
^\/os\/+(.*)$ = /os/router.lua?r=<1>&<query>
; This enable some plugins to be initialised at server startup
[AUTOSTART]
plugin = tunnel
; to start a plugin at server statup use:
;plugin = plugin_name_1
;plugin = plugin_name_2, etc
[MIMES]
image/bmp=bmp
image/jpeg=jpg,jpeg
text/css=css
text/markdown=md
text/csv=csv
application/pdf=pdf
image/gif=gif
text/html=html,htm,chtml
application/json=json
application/javascript=js
image/png=png
image/x-portable-pixmap=ppm
application/x-rar-compressed=rar
image/tiff=tiff
application/x-tar=tar
text/plain=txt
application/x-font-ttf=ttf
application/xhtml+xml=xhtml
application/xml=xml
application/zip=zip
image/svg+xml=svg
application/vnd.ms-fontobject=eot
application/x-font-woff=woff,woff2
application/x-font-otf=otf
audio/mpeg=mp3,mpeg
[FILEHANDLER]
; specify a plugin for handling
; a file type
; lua page script
ls = lua
; pure lua script
lua = lua
; php and o ther scripting languages can be
; handled by the cgi plugin
; php = cgi

64
bake.sh
View File

@ -1,44 +1,38 @@
#! /bin/bash #! /bin/bash
if [ -d "download" ]; then if [ ! -d "download" ]; then
rm -rf download mkdir download
cd download || (echo "Unable to change directory" && exit 1)
wget https://github.com/lxsang/ant-http/raw/master/dist/antd-1.0.6b.tar.gz
tar xvzf antd-1.0.6b.tar.gz
rm antd-1.0.6b.tar.gz
wget https://github.com/lxsang/antd-lua-plugin/raw/master/dist/lua-0.5.2b.tar.gz
tar xvzf lua-0.5.2b.tar.gz
rm lua-0.5.2b.tar.gz
wget https://github.com/lxsang/antd-wterm-plugin/raw/master/dist/wterm-1.0.0b.tar.gz
tar xvzf wterm-1.0.0b.tar.gz
rm wterm-1.0.0b.tar.gz
wget https://github.com/lxsang/antd-tunnel-plugin/raw/master/dist/tunnel-0.1.0b.tar.gz
tar xvzf tunnel-0.1.0b.tar.gz
rm tunnel-0.1.0b.tar.gz
wget https://github.com/lxsang/antd-tunnel-publishers/raw/master/dist/antd-publishers-0.1.0a.tar.gz
tar xvzf antd-publishers-0.1.0a.tar.gz
rm antd-publishers-0.1.0a.tar.gz
git clone --depth 1 https://github.com/lxsang/antd-web-apps
git clone https://github.com/lxsang/antos
cd antos && git checkout next-1.2.0 && cd ..
cd ../
fi fi
mkdir download
cd download || (echo "Unable to change directory" && exit 1)
wget https://github.com/lxsang/ant-http/raw/master/dist/antd-1.0.6b.tar.gz
tar xvzf antd-1.0.6b.tar.gz
rm antd-1.0.6b.tar.gz
wget https://github.com/lxsang/antd-lua-plugin/raw/master/dist/lua-0.5.2b.tar.gz
tar xvzf lua-0.5.2b.tar.gz
rm lua-0.5.2b.tar.gz
wget https://github.com/lxsang/antd-wterm-plugin/raw/master/dist/wterm-1.0.0b.tar.gz
tar xvzf wterm-1.0.0b.tar.gz
rm wterm-1.0.0b.tar.gz
wget https://github.com/lxsang/antd-tunnel-plugin/raw/master/dist/tunnel-0.1.0b.tar.gz
tar xvzf tunnel-0.1.0b.tar.gz
rm tunnel-0.1.0b.tar.gz
wget https://github.com/lxsang/antd-tunnel-publishers/raw/master/dist/antd-publishers-0.1.0a.tar.gz
tar xvzf antd-publishers-0.1.0a.tar.gz
rm antd-publishers-0.1.0a.tar.gz
git clone --depth 1 https://github.com/lxsang/antd-web-apps
git clone --depth 1 https://github.com/lxsang/antos
cd ../
docker build -t antosaio . docker build -t antosaio .
if [ -d "download" ]; then
rm -rf download
fi
mkdir -p dist mkdir -p dist
docker save antosaio > dist/antosaio.tar docker save antosaio > dist/antosaio.tar
# sudo docker run -p 8080:80 -it antosaoi /bin/sh # sudo docker run -p 8080:80 -it antosaoi /bin/sh

BIN
dist/antosaio.tar vendored

Binary file not shown.

7
start.sh Executable file
View File

@ -0,0 +1,7 @@
#! /bin/sh
ln -sf /app/home "/home/$ANTOS_USER"
adduser --home "/home/$ANTOS_USER" --disabled-password --gecos "" "$ANTOS_USER"
echo -e "$ANTOS_PASSWORD\n$ANTOS_PASSWORD" | passwd "$ANTOS_USER"
# start antd-tunnel service
[ -f /app/runner.ini ] && /opt/www/bin/runner /app/runner.ini &
/usr/bin/antd /app/antd-config.ini