first commit

This commit is contained in:
Giuseppe Naponiello
2026-06-14 19:01:02 +02:00
commit 36bcc9a842
98 changed files with 26936 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
FROM php:8.4-fpm-alpine AS base
LABEL maintainer="Giuseppe Naponiello"
LABEL version="3.0.0"
LABEL description="Dynamic Collections Plus is a web platform for building and curating digital collections of archaeological artefacts. Backend container."
RUN apk add --no-cache \
mysql-dev mysql-client \
libpq libpng-dev libzip-dev \
zip unzip \
git \
oniguruma-dev \
icu-dev \
linux-headers \
nginx supervisor \
$PHPIZE_DEPS && \
docker-php-ext-install pdo_mysql gd zip intl bcmath pcntl && \
pecl install redis pcov && \
docker-php-ext-enable redis pcov && \
apk del $PHPIZE_DEPS
WORKDIR /var/www/html
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# composer.lock è opzionale finché non viene generato (il glob `*` non fallisce se assente)
COPY composer.json composer.lock* ./
ARG APP_ENV=production
RUN if [ "$APP_ENV" = "production" ]; then \
composer install --no-dev --no-scripts --no-autoloader; \
else \
composer install --no-scripts --no-autoloader; \
fi
# Copie esplicite (no `COPY . .` — docker:S6470): solo l'app Laravel, così non
# finiscono nell'immagine .env (segreti), vendor host (dev-deps) o file locali.
# Il .dockerignore è una rete di sicurezza ulteriore.
COPY app/ ./app/
COPY bootstrap/ ./bootstrap/
COPY config/ ./config/
COPY database/ ./database/
COPY public/ ./public/
COPY resources/ ./resources/
COPY routes/ ./routes/
COPY storage/ ./storage/
COPY artisan ./
# Ottimizzazione autoloader + permessi storage
RUN composer dump-autoload --optimize && \
chown -R www-data:www-data storage bootstrap/cache && \
chmod -R 775 storage bootstrap/cache
# Entrypoint per migrations e bootstrap
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["entrypoint.sh"]
# ----------------------------
# STAGE: development
# Override del CMD tramite docker-compose.override.yml:
# command: ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
# ----------------------------
FROM base AS development
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
# ----------------------------
# STAGE: production
# Nginx + php-fpm gestiti da supervisord
# ----------------------------
FROM base AS production
COPY docker/nginx-backend.conf /etc/nginx/http.d/default.conf
COPY docker/supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]