api/Dockerfile

34 lines
823 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM laravelsail/php84-composer AS build
WORKDIR /var/www/html
# Copier le code
COPY . .
# Installer les dépendances PHP (prod)
RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
# Si tu as du front (Vite), tu pourrais ajouter :
# RUN npm ci && npm run build
# -----------------------------
# Étape 2 : runtime
# -----------------------------
FROM laravelsail/php84-composer
WORKDIR /var/www/html
# Copier les fichiers depuis létape build
COPY --from=build /var/www/html /var/www/html
# (Optionnel) Tu peux retirer les fichiers inutiles ici (tests, etc.)
# ⚠️ On désactive l'ENTRYPOINT de l'image de base
ENTRYPOINT []
# Port HTTP exposé dans le container
EXPOSE 80
# Lancer Laravel via php artisan serve
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=80"]