add build script

This commit is contained in:
lxsang 2020-06-26 15:51:13 +02:00
parent 71cec8dac0
commit 2a0b8c3c77
5 changed files with 180 additions and 0 deletions

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM alpine AS build-env
RUN apk add build-base make sqlite-dev zlib-dev readline-dev nodejs npm
COPY download /download
RUN cd /download/antd-1.0.4b && ./configure --prefix=/usr/ --enable-debug=yes && make && make install
RUN cd /download/lua-0.5.2b && ./configure --prefix=/opt/www --enable-debug=yes && make && make install
RUN cd /download/wterm-1.0.0b && ./configure --prefix=/opt/www --enable-debug=yes && make && make install
RUN mkdir -p /opt/www/htdocs
RUN cd /download/antd-web-apps && BUILDDIR=/opt/www/htdocs PROJS=os make
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
FROM alpine
RUN apk add --no-cache sqlite-dev zlib readline-dev
COPY antd-config.ini /etc/antd-config.ini
COPY --from=build-env /usr/bin/antd /usr/bin/antd
COPY --from=build-env /usr/lib/libantd* /usr/lib/
COPY --from=build-env /opt/www /opt/www
RUN adduser --home /home/demo --disabled-password --gecos "" demo
RUN echo -e "demo\ndemo" | passwd demo
ENTRYPOINT LD_PRELOAD=/opt/www/lib/lua/core.so /usr/bin/antd /etc/antd-config.ini

View File

@ -1 +1,47 @@
# antosaio
Docker image layer for All-in-one AntOS VDE system.
This layer allows to build a minimal docker image with an
out-of-the-box working AntOS system:
- The web-server (HTTP only) on port 80
- AntOS server side API
- AntOS client side API
## How it works ?
The following manual requires docker to be installed on the host system.
A prebuilt image can be found in `dist`, the image can be imported
to docker and ready to use:
```sh
wget
sudo docker load < antosaoi.tar
```
The image can be run in a container using
```sh
sudo docker run -p 8080:80 -it antosaoi
```
Here we map the host port 8080 to the port 80 on the `antosaoi` container.
From the host browser, the VDE can be accessed via
```
http://localhost:8080/os/
```
Note that: the `/` at the end of the URL is important.
### Build your own image
It is really simple to build your own AntOS docker image:
```sh
git clone --depth 1 https://github.com/lxsang/antosaio
cd antosaio
chmod +x bake.sh
sudo ./bake.sh
```
The generated image can be found in `dist`, and will be loaded automatically by docker

77
antd-config.ini Normal file
View File

@ -0,0 +1,77 @@
[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]
; 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

36
bake.sh Executable file
View File

@ -0,0 +1,36 @@
#! /bin/bash
if [ -d "download" ]; then
rm -rf download
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.4b.tar.gz
tar xvzf antd-1.0.4b.tar.gz
rm antd-1.0.4b.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
git clone --depth 1 https://github.com/lxsang/antd-web-apps
git clone --depth 1 https://github.com/lxsang/antos
cd ../
docker build -t antosaoi .
if [ -d "download" ]; then
rm -rf download
fi
mkdir -p dist
docker save antosaoi > dist/antosaoi.tar
# sudo docker run -p 8080:80 -it antosaoi /bin/sh

BIN
dist/antosaoi.tar vendored Normal file

Binary file not shown.