Simplificar Docker a imagen única y actualizar workflow CI/CD
This commit is contained in:
18
.dockerignore
Normal file
18
.dockerignore
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
node_modules
|
||||||
|
*/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
*.log
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
*/dist
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
*.md
|
||||||
|
*.mmd
|
||||||
|
*.pdf
|
||||||
|
*.png
|
||||||
|
.gitea
|
||||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copiar archivos de configuración
|
||||||
|
COPY package*.json ./
|
||||||
|
COPY server/package*.json ./server/
|
||||||
|
COPY client/package*.json ./client/
|
||||||
|
|
||||||
|
# Instalar dependencias
|
||||||
|
RUN npm install
|
||||||
|
RUN cd server && npm install
|
||||||
|
RUN cd client && npm install
|
||||||
|
|
||||||
|
# Copiar código fuente
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Compilar servidor y cliente
|
||||||
|
RUN cd server && npm run build
|
||||||
|
RUN cd client && npm run build
|
||||||
|
|
||||||
|
# Instalar serve para servir archivos estáticos
|
||||||
|
RUN npm install -g serve
|
||||||
|
|
||||||
|
# Script de inicio
|
||||||
|
COPY start.sh /app/start.sh
|
||||||
|
RUN chmod +x /app/start.sh
|
||||||
|
|
||||||
|
# Exponer puertos
|
||||||
|
EXPOSE 3000 2567
|
||||||
|
|
||||||
|
# Ejecutar ambos servicios
|
||||||
|
CMD ["/app/start.sh"]
|
||||||
15
start.sh
Normal file
15
start.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Iniciar el servidor Colyseus en background
|
||||||
|
echo "Starting Colyseus server..."
|
||||||
|
cd /app/server && node dist/index.js &
|
||||||
|
|
||||||
|
# Esperar un momento para que el servidor inicie
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
# Servir el cliente compilado
|
||||||
|
echo "Starting client server..."
|
||||||
|
cd /app/client && serve -s dist -l 3000 &
|
||||||
|
|
||||||
|
# Mantener el contenedor corriendo
|
||||||
|
wait
|
||||||
Reference in New Issue
Block a user