diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..00f1bdda --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:24.04 + +RUN mkdir -p /home/wiki +COPY . /home/wiki +WORKDIR /home/wiki +RUN bash install_os_dependencies.sh install +RUN python3 -m venv /opt/venv +RUN /opt/venv/bin/python3 -m pip install -r requirements.txt +ENV PATH="/opt/venv/bin:$PATH" +CMD ["/bin/bash", "develop_server.sh", "docker_start"] diff --git a/README.md b/README.md index 02651259..86dac320 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,12 @@ Resta então fazer o commit de suas alterações em seu repositório local e env Mais informações sobre como funciona o Pelican, indicamos o artigo - [http://mindbending.org/pt/instalando-o-pelican](http://mindbending.org/pt/instalando-o-pelican). +Se você quiser gerar o site automaticamente a cada alteração, utilize: + +``` +$ make devserver +``` + Caso queira contribuir com o tema é preciso ter o node instalado em sua máquina. Sua instalação é bem direta e pode ser obtida em: [https://nodejs.org/en/download/](https://nodejs.org/en/download/) @@ -178,3 +184,20 @@ E caso queira rodar sem o live reload, somente para gerar o css para publicaçã ``` $ npm run gulp build ``` + +#### Rodando com Docker + +Criando a imagem: +``` +docker build -t wiki . +``` + +Rodando: +``` +docker run --rm -t -i -p 8000:8000 -v .:/home/wiki --name pelican wiki +``` + +Parando a imagem: +``` +docker stop pelican +``` \ No newline at end of file diff --git a/develop_server.sh b/develop_server.sh index 2661df30..5d89762b 100755 --- a/develop_server.sh +++ b/develop_server.sh @@ -2,6 +2,7 @@ ## # This section should match your Makefile ## + PY=${PY:-python} PELICAN=${PELICAN:-pelican} PELICANOPTS= @@ -19,7 +20,7 @@ SRV_PID=$BASEDIR/srv.pid PELICAN_PID=$BASEDIR/pelican.pid function usage(){ - echo "usage: $0 (stop) (start) (restart) [port]" + echo "usage: $0 (stop) (start) (restart) (docker_start) [port]" echo "This starts Pelican in debug and reload mode and then launches" echo "an HTTP server to help site development. It doesn't read" echo "your Pelican settings, so if you edit any paths in your Makefile" @@ -67,11 +68,14 @@ function start_up(){ pelican_pid=$! echo $pelican_pid > $PELICAN_PID mkdir -p $OUTPUTDIR && cd $OUTPUTDIR - $PY -m pelican.server $port & + $PY -m pelican --listen $port & + srv_pid=$! echo $srv_pid > $SRV_PID cd $BASEDIR + sleep 1 + if ! alive $pelican_pid ; then echo "Pelican didn't start. Is the Pelican package installed?" return 1 @@ -82,6 +86,10 @@ function start_up(){ echo 'Pelican and HTTP server processes now running in background.' } +function docker_start(){ + $PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS -l -b 0.0.0.0 -D +} + ### # MAIN ### @@ -98,6 +106,8 @@ elif [[ $1 == "start" ]]; then if ! start_up $port; then shut_down fi +elif [[ $1 == "docker_start" ]]; then + docker_start else usage fi diff --git a/install_os_dependencies.sh b/install_os_dependencies.sh index aea9dec4..d713238a 100755 --- a/install_os_dependencies.sh +++ b/install_os_dependencies.sh @@ -29,12 +29,12 @@ function list_packages(){ function install() { - list_packages | xargs apt-get --no-upgrade install -y; + list_packages | xargs apt --no-upgrade install -y; } function upgrade() { - list_packages | xargs apt-get install -y; + list_packages | xargs apt install -y; } @@ -52,7 +52,7 @@ function install_or_upgrade() exit 1 else - apt-get update + apt update # Install the basic compilation dependencies and other required libraries of this project if [ "$PARAN" == "install" ]; then @@ -62,7 +62,7 @@ function install_or_upgrade() fi # cleaning downloaded packages from apt-get cache - apt-get clean + apt clean exit 0 fi diff --git a/requirements.apt b/requirements.apt index 94ea69a3..abb3f4b6 100644 --- a/requirements.apt +++ b/requirements.apt @@ -1,5 +1,8 @@ # listar as dependencias nao python aqui (Ubuntu 14.04 de preferencia) -python-dev +python3-dev +python-is-python3 +python3-pip +python3-venv build-essential # lxml dependencies @@ -8,10 +11,10 @@ libxml2-dev ## Pillow dependencies zlib1g-dev -libtiff4-dev +libtiff-dev libjpeg8-dev libfreetype6-dev -liblcms1-dev +#liblcms1-dev libwebp-dev #cryptography dependecies diff --git a/requirements.txt b/requirements.txt index a331bf58..a1908f86 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ paramiko pelican==4.7.1 pelican-alias==1.1 pillow -pycrypto +pycryptodome pygments python-dateutil pytz