-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
82 lines (65 loc) · 2.37 KB
/
Copy pathDockerfile.dev
File metadata and controls
82 lines (65 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Usar imagen oficial de Node.js basada en Debian (versión más actual)
FROM node:24-bullseye
ARG NGROK_AUTH_TOKEN
# Configurar zona horaria GMT-5
ENV TZ=America/Lima
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Instalar dependencias adicionales y PowerShell 7
RUN apt-get update && apt-get install -y \
git \
wget \
apt-transport-https \
software-properties-common \
cron \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Instalar PowerShell 7
RUN wget -q https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y powershell \
&& rm -rf /var/lib/apt/lists/*
# Instalar módulo de PowerShell para Exchange Online
RUN pwsh -Command "Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber"
# Instalar ngrok
RUN wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
RUN tar -xvzf ngrok-v3-stable-linux-amd64.tgz
RUN mv ngrok /usr/local/bin/ngrok \
&& chmod +x /usr/local/bin/ngrok \
&& rm ngrok-v3-stable-linux-amd64.tgz
# Configurar ngrok con el token de autenticación
RUN ngrok config add-authtoken ${NGROK_AUTH_TOKEN}
# Crear directorio de trabajo
WORKDIR /app
# Copiar archivos de configuración de dependencias primero
COPY package*.json ./
COPY tsconfig*.json ./
# Instalar dependencias
RUN npm install
# Instalar navegadores de Playwright y sus dependencias del sistema
RUN npx playwright install --with-deps chromium
# Copiar el resto del código fuente
COPY . .
# Compilar el proyecto
RUN npm run build
# Crear directorio para logs de cron
RUN mkdir -p /var/log/cron
# Copiar archivo de crontab
COPY infra/cron/crontab /etc/cron.d/app-cron
RUN chmod 0644 /etc/cron.d/app-cron && crontab /etc/cron.d/app-cron
# Crear script de inicio
RUN echo '#!/bin/bash\n\
# Iniciar cron\n\
cron\n\
# Iniciar ngrok en segundo plano\n\
nohup ngrok http 8080 --log=stdout --log-level=info > /app/ngrok.log 2>&1 &\n\
# Esperar un momento para que ngrok se inicie\n\
sleep 10\n\
# Mostrar la URL pública\n\
echo "Ngrok is starting... Check /app/ngrok.log for details"\n\
# Iniciar la aplicación principal\n\
exec node dist/src/index.js' > /app/start.sh \
&& chmod +x /app/start.sh
# Mantener el contenedor en ejecución para trabajo manual
CMD ["/app/start.sh"]