Transformando a docker

This commit is contained in:
2021-12-13 21:50:55 -03:00
parent 2b0134fff9
commit eebbda99dc
6 changed files with 20 additions and 38 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
venv/
.git/
www/

15
Dockerfile Normal file
View File

@@ -0,0 +1,15 @@
FROM python:3 as builder
WORKDIR /usr/src/app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN mkdir www/
RUN python generator
###########################################################
FROM nginx:latest as deployer
COPY --from=builder /usr/src/app/www /usr/share/nginx/html

View File

@@ -5,9 +5,6 @@ import time
import shutil
from pathlib import Path
from markdown import markdown
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
src_dir = Path('src')
out_dir = Path('www')
@@ -75,35 +72,6 @@ def execute():
print('parsing {} as any'.format(path))
process_any(path)
class WatchHandler(PatternMatchingEventHandler):
patterns = ["*.py", "*.md", "*.css", "*.js"]
def process(self, event):
execute()
def on_modified(self, event):
self.process(event)
def on_created(self, event):
self.process(event)
if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] == '--watch':
observer = Observer()
observer.schedule(WatchHandler(), str(src_dir), recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
else:
execute()
execute()

View File

@@ -1,3 +1,2 @@
markdown
pygments
watchdog

View File

@@ -18,7 +18,7 @@ El codigo que he escrito para distintos proyectos lo mantengo en
intento mantener de las redes sociales. Y finalmente, si me quieres enviar un
correo, mi dirección es hola@danielcortes.xyz
##[Posts](/blog)
##[Posts](/blog/index.html)
Aqui posteo lo que intento escribir una vez al año. Me cuesta conseguir ideas y
ganas para sentarme a escribir algo pero me agrada tener la posibilidad aqui.

3
sync
View File

@@ -1,3 +0,0 @@
#!/usr/bin/bash
rsync -av www/ zgh:www-dir/www.danielcortes.xyz/