Skip to content

Commit 4338f0d

Browse files
authored
Atualizações para rodar no Ubuntu 24.04. Adicionado Dockerfile para facilitar execução (#300)
* Atualizações para rodar no Ubuntu 24.04. Adicionado Dockerfile para facilitar a configuração * Adicionando as altearações do README
1 parent 2fa97a7 commit 4338f0d

6 files changed

Lines changed: 56 additions & 10 deletions

File tree

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu:24.04
2+
3+
RUN mkdir -p /home/wiki
4+
COPY . /home/wiki
5+
WORKDIR /home/wiki
6+
RUN bash install_os_dependencies.sh install
7+
RUN python3 -m venv /opt/venv
8+
RUN /opt/venv/bin/python3 -m pip install -r requirements.txt
9+
ENV PATH="/opt/venv/bin:$PATH"
10+
CMD ["/bin/bash", "develop_server.sh", "docker_start"]

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ Resta então fazer o commit de suas alterações em seu repositório local e env
156156

157157
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).
158158

159+
Se você quiser gerar o site automaticamente a cada alteração, utilize:
160+
161+
```
162+
$ make devserver
163+
```
164+
159165
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:
160166

161167
[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çã
178184
```
179185
$ npm run gulp build
180186
```
187+
188+
#### Rodando com Docker
189+
190+
Criando a imagem:
191+
```
192+
docker build -t wiki .
193+
```
194+
195+
Rodando:
196+
```
197+
docker run --rm -t -i -p 8000:8000 -v .:/home/wiki --name pelican wiki
198+
```
199+
200+
Parando a imagem:
201+
```
202+
docker stop pelican
203+
```

develop_server.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
##
33
# This section should match your Makefile
44
##
5+
56
PY=${PY:-python}
67
PELICAN=${PELICAN:-pelican}
78
PELICANOPTS=
@@ -19,7 +20,7 @@ SRV_PID=$BASEDIR/srv.pid
1920
PELICAN_PID=$BASEDIR/pelican.pid
2021

2122
function usage(){
22-
echo "usage: $0 (stop) (start) (restart) [port]"
23+
echo "usage: $0 (stop) (start) (restart) (docker_start) [port]"
2324
echo "This starts Pelican in debug and reload mode and then launches"
2425
echo "an HTTP server to help site development. It doesn't read"
2526
echo "your Pelican settings, so if you edit any paths in your Makefile"
@@ -67,11 +68,14 @@ function start_up(){
6768
pelican_pid=$!
6869
echo $pelican_pid > $PELICAN_PID
6970
mkdir -p $OUTPUTDIR && cd $OUTPUTDIR
70-
$PY -m pelican.server $port &
71+
$PY -m pelican --listen $port &
72+
7173
srv_pid=$!
7274
echo $srv_pid > $SRV_PID
7375
cd $BASEDIR
76+
7477
sleep 1
78+
7579
if ! alive $pelican_pid ; then
7680
echo "Pelican didn't start. Is the Pelican package installed?"
7781
return 1
@@ -82,6 +86,10 @@ function start_up(){
8286
echo 'Pelican and HTTP server processes now running in background.'
8387
}
8488

89+
function docker_start(){
90+
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS -l -b 0.0.0.0 -D
91+
}
92+
8593
###
8694
# MAIN
8795
###
@@ -98,6 +106,8 @@ elif [[ $1 == "start" ]]; then
98106
if ! start_up $port; then
99107
shut_down
100108
fi
109+
elif [[ $1 == "docker_start" ]]; then
110+
docker_start
101111
else
102112
usage
103113
fi

install_os_dependencies.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ function list_packages(){
2929

3030
function install()
3131
{
32-
list_packages | xargs apt-get --no-upgrade install -y;
32+
list_packages | xargs apt --no-upgrade install -y;
3333
}
3434

3535
function upgrade()
3636
{
37-
list_packages | xargs apt-get install -y;
37+
list_packages | xargs apt install -y;
3838
}
3939

4040

@@ -52,7 +52,7 @@ function install_or_upgrade()
5252
exit 1
5353
else
5454

55-
apt-get update
55+
apt update
5656

5757
# Install the basic compilation dependencies and other required libraries of this project
5858
if [ "$PARAN" == "install" ]; then
@@ -62,7 +62,7 @@ function install_or_upgrade()
6262
fi
6363

6464
# cleaning downloaded packages from apt-get cache
65-
apt-get clean
65+
apt clean
6666

6767
exit 0
6868
fi

requirements.apt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# listar as dependencias nao python aqui (Ubuntu 14.04 de preferencia)
2-
python-dev
2+
python3-dev
3+
python-is-python3
4+
python3-pip
5+
python3-venv
36
build-essential
47

58
# lxml dependencies
@@ -8,10 +11,10 @@ libxml2-dev
811

912
## Pillow dependencies
1013
zlib1g-dev
11-
libtiff4-dev
14+
libtiff-dev
1215
libjpeg8-dev
1316
libfreetype6-dev
14-
liblcms1-dev
17+
#liblcms1-dev
1518
libwebp-dev
1619

1720
#cryptography dependecies

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ paramiko
1313
pelican==4.7.1
1414
pelican-alias==1.1
1515
pillow
16-
pycrypto
16+
pycryptodome
1717
pygments
1818
python-dateutil
1919
pytz

0 commit comments

Comments
 (0)