up
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# Dockerfile para workers dedicados (sin Nginx)
|
||||
FROM php:8.2-cli-alpine
|
||||
|
||||
# Instalar dependencias
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
libzip \
|
||||
libzip-dev \
|
||||
icu \
|
||||
icu-dev \
|
||||
icu-libs \
|
||||
oniguruma \
|
||||
oniguruma-dev \
|
||||
mysql-client \
|
||||
redis \
|
||||
zlib-dev
|
||||
|
||||
# Instalar extensiones PHP
|
||||
RUN docker-php-ext-install -j$(nproc) \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
mysqli \
|
||||
zip \
|
||||
intl \
|
||||
mbstring \
|
||||
pcntl \
|
||||
opcache
|
||||
|
||||
# Instalar Redis extension
|
||||
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& apk del .build-deps
|
||||
|
||||
# Crear usuario
|
||||
RUN addgroup -g 1000 -S www && \
|
||||
adduser -u 1000 -S www -G www
|
||||
|
||||
# Copiar Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Copiar código
|
||||
COPY --chown=www:www . .
|
||||
|
||||
# Instalar dependencias
|
||||
RUN if [ -f composer.json ]; then \
|
||||
composer install --no-dev --optimize-autoloader --no-interaction; \
|
||||
fi
|
||||
|
||||
# Dar permisos
|
||||
RUN chmod +x worker.php
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=60s --timeout=5s --start-period=30s --retries=3 \
|
||||
CMD pgrep -f "worker.php" || exit 1
|
||||
|
||||
USER www
|
||||
|
||||
CMD ["php", "worker.php", "--daemon"]
|
||||
Reference in New Issue
Block a user