NewTube/docker/Dockerfile

51 lines
1.3 KiB
Docker

# Utilisez une image Node.js
FROM node:20-alpine
# Créez le répertoire de l'application
WORKDIR /app
# D'abord, copiez uniquement les fichiers nécessaires pour l'installation
COPY package*.json ./
# Installez les dépendances
RUN npm install --only=production
# Puis copiez le reste du code
COPY . .
# Construisez l'application Angular
RUN npm run build -- --configuration=production
# Exposez le port
EXPOSE 4000
# Commande de démarrage
CMD ["node", "server/index.mjs"]
# Add a HEALTHCHECK for NGINX
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
# FROM nginx:alpine
# # Install dos2unix
# RUN apk add --no-cache dos2unix
# # Copy and normalize entrypoint script
# COPY scripts/env-dump.sh /docker-entrypoint.d/env-dump.sh
# RUN dos2unix /docker-entrypoint.d/env-dump.sh \
# && chmod +x /docker-entrypoint.d/env-dump.sh
# # Copy and normalize nginx config
# COPY config/nginx.conf /etc/nginx/nginx.conf
# RUN dos2unix /etc/nginx/nginx.conf
# # Copy built Angular app
# COPY dist /usr/share/nginx/html
# # Optional: ensure correct file ownership and permissions
# RUN mkdir -p /usr/share/nginx/html/assets \
# && chown -R nginx:nginx /usr/share/nginx/html \
# && chmod -R 755 /usr/share/nginx/html