Skip to content

Commit eacdda7

Browse files
committed
modificar el dockerfile 3
1 parent d0a807f commit eacdda7

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

Dockerfile

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.4-apache
1+
FROM unit:php8.4
22

33
# Instalar dependencias del sistema y extensiones PHP
44
RUN apt-get update && apt-get install -y \
@@ -21,22 +21,32 @@ RUN echo "memory_limit=512M" > /usr/local/etc/php/conf.d/memory.ini \
2121
&& echo "post_max_size=256M" >> /usr/local/etc/php/conf.d/memory.ini \
2222
&& echo "max_execution_time=300" >> /usr/local/etc/php/conf.d/memory.ini
2323

24-
# Habilitar mod_rewrite para Slim
25-
RUN a2enmod rewrite
26-
27-
# Configurar Apache para Slim
28-
RUN echo '<VirtualHost *:8081>\n\
29-
DocumentRoot /var/www/html/public\n\
30-
<Directory /var/www/html/public>\n\
31-
AllowOverride All\n\
32-
Require all granted\n\
33-
</Directory>\n\
34-
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
35-
3624
# Copiar código (incluyendo vendor)
3725
COPY . /var/www/html/
3826

27+
WORKDIR /var/www/html
28+
29+
# Crear directorios necesarios y establecer permisos
30+
RUN mkdir -p logs var/cache var/log \
31+
&& chown -R unit:unit . \
32+
&& chmod -R 755 logs var
33+
34+
# Configuración de Unit para Slim
35+
RUN echo '{\
36+
"listeners": {\
37+
"*:8081": {\
38+
"pass": "applications/slim_app"\
39+
}\
40+
},\
41+
"applications": {\
42+
"slim_app": {\
43+
"type": "php",\
44+
"root": "/var/www/html/public",\
45+
"script": "index.php"\
46+
}\
47+
}\
48+
}' > /docker-entrypoint.d/config.json
3949

4050
EXPOSE 8081
4151

42-
CMD ["apache2-foreground"]
52+
CMD ["unitd", "--no-daemon"]

0 commit comments

Comments
 (0)