Initial commit
This commit is contained in:
42
docker/Dockerfile.frontend
Normal file
42
docker/Dockerfile.frontend
Normal file
@@ -0,0 +1,42 @@
|
||||
# Frontend Dockerfile (reutilizable para client e internal)
|
||||
FROM node:18-alpine
|
||||
|
||||
# Instalar dependencias del sistema
|
||||
RUN apk add --no-cache \
|
||||
git \
|
||||
curl
|
||||
|
||||
# Configurar directorio de trabajo
|
||||
WORKDIR /app
|
||||
|
||||
# Crear usuario no root
|
||||
RUN addgroup -g 1001 -S nodejs \
|
||||
&& adduser -S app -u 1001 -G nodejs
|
||||
|
||||
# Copiar package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Configurar npm para ignorar certificados SSL (solo para desarrollo)
|
||||
RUN npm config set strict-ssl false
|
||||
|
||||
# Instalar dependencias
|
||||
RUN npm install --legacy-peer-deps && npm cache clean --force
|
||||
|
||||
# Copiar código de la aplicación
|
||||
COPY . .
|
||||
|
||||
# Cambiar permisos
|
||||
RUN chown -R app:nodejs /app
|
||||
|
||||
# Cambiar a usuario no root
|
||||
USER app
|
||||
|
||||
# Exponer puerto
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD curl -f http://localhost:3000 || exit 1
|
||||
|
||||
# Comando por defecto
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
||||
Reference in New Issue
Block a user