main
ifiguero 2024-03-10 00:58:06 -03:00
parent 49318e2cea
commit fbd02757c4
6 changed files with 61 additions and 18 deletions

View File

@ -1,12 +1,17 @@
FROM python:3.11-alpine
RUN apk update
RUN apk add git
FROM python:3.11-slim
RUN apt-get update && apt-get -y install git && apt-get clean
RUN useradd -m app
RUN git clone https://72d861f982d2a76275d5b8178fe0633b19c43d33@dev.ilab.cl/TDTP/admin_transporte_backend /srv
WORKDIR /srv
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN chown -R app:app /srv
USER app
ENTRYPOINT ["python3"]

View File

@ -13,13 +13,17 @@ WORKDIR /frontend
RUN npm install && npm run build
# Contenedor backend
FROM python:3.11-alpine
FROM python:3.11-slim
RUN apt-get update && apt-get -y install git && apt-get clean
RUN useradd -m app
WORKDIR /srv
# Actualiza el contenido
COPY --from=frontend /backend/requirements.txt /srv
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY --from=frontend /backend/readme.md /srv
COPY --from=frontend /frontend/dist/ /srv/project/dist
@ -27,5 +31,8 @@ COPY --from=frontend /backend/project/ /srv/project
COPY paradero.admin_transporte_backend.py /srv/project/api/views/paradero.py
RUN chown -R app:app /srv
USER app
ENTRYPOINT ["python3"]
CMD [ "/srv/project/manage.py", "runserver", "0.0.0.0:4000" ]

View File

@ -13,13 +13,17 @@ WORKDIR /frontend
RUN npm install && npm run build
# Contenedor backend
FROM python:3.11-alpine
FROM python:3.11-slim
RUN apt-get update && apt-get -y install git && apt-get clean
RUN useradd -m app
WORKDIR /srv
# Actualiza el contenido
COPY --from=frontend /backend/requirements.txt /srv
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY --from=frontend /backend/readme.md /srv
COPY --from=frontend /frontend/dist/ /srv/project/dist
@ -27,5 +31,8 @@ COPY --from=frontend /backend/project/ /srv/project
COPY paradero.admin_transporte_backend.py /srv/project/api/views/paradero.py
RUN chown -R app:app /srv
USER app
ENTRYPOINT ["python3"]
CMD [ "/srv/project/manage.py", "runserver", "0.0.0.0:4000" ]

View File

@ -1,12 +1,14 @@
FROM python:3.11-alpine
RUN apk update
RUN apk add git
FROM python:3.11-slim
RUN apt-get update && apt-get -y install git && apt-get clean
RUN useradd -m app
RUN git clone https://72d861f982d2a76275d5b8178fe0633b19c43d33@dev.ilab.cl/TDTP/cms_backend /srv
WORKDIR /srv
RUN pip install -r myproject/requirements.txt
RUN pip install --no-cache-dir -r myproject/requirements.txt
ENTRYPOINT ["python3"]

View File

@ -1,12 +1,22 @@
FROM python:3.11-alpine
RUN apk update
RUN apk add git
FROM python:3.11-slim
RUN apt-get update && apt-get -y install git && apt-get clean
RUN useradd -m app
RUN git clone https://72d861f982d2a76275d5b8178fe0633b19c43d33@dev.ilab.cl/TDTP/proto_backend /srv
EXEC echo apscheduler >> /srv/requirements.txt
COPY fetch.backend_proto.py /srv/fetch.py
RUN pip install --no-cache-dir -r /srv/requirements.txt
WORKDIR /srv
RUN pip install -r requirements.txt
RUN chown -R app:app /srv
USER app
ENTRYPOINT ["watch"]
CMD ["-n", "30", "-t", "python", "main.py"]
ENTRYPOINT ["python"]
CMD ["fetch.py"]

View File

@ -0,0 +1,12 @@
# coding: utf-8
from apscheduler.schedulers.background import BlockingScheduler
from main import main as rutina_principal
import logging
sched = BlockingScheduler()
sched.add_job(rutina_principal, 'interval', seconds=int(os.environ.get('INTERVAL'))) #will do the print_t work for every 30 seconds
if __name__ == '__main__':
init_db(db, engine)
sched.start()