1+ FROM alpine:3.21
2+ LABEL Maintainer="Rick Bennett <rbennett1106@gmail.com>"
3+
4+ # Essentials
5+ RUN echo "UTC" > /etc/timezone
6+ RUN apk add --no-cache zip unzip curl python3 supervisor
7+
8+ # PHP Configuration (8.3.17-r0)
9+ RUN apk add --no-cache \
10+ php83 \
11+ php83-bcmath \
12+ php83-ctype \
13+ php83-curl \
14+ php83-dom \
15+ php83-fileinfo \
16+ php83-fpm \
17+ php83-json \
18+ php83-mbstring \
19+ php83-opcache \
20+ php83-openssl \
21+ php83-pdo_mysql \
22+ php83-phar \
23+ php83-session \
24+ php83-simplexml \
25+ php83-tokenizer \
26+ php83-xml \
27+ php83-xmlwriter \
28+ php83-zip
29+
30+ # Nginx Configuration (1.26.2-r4)
31+ RUN apk add --no-cache nginx
32+
33+ # Setup the user and group permissions
34+ RUN adduser -D -g 'www' www
35+
36+ # Link php83 to php
37+ RUN ln -sf php83 /usr/bin/php && \
38+ ln -sf /usr/sbin/php-fpm83 /usr/bin/php-fpm && \
39+ ln -sf /etc/php83 /etc/php && \
40+ ln -sf /usr/bin/python3 /usr/bin/python
41+
42+ # Bootstrap directories
43+ RUN mkdir -p /app && \
44+ mkdir -p /var/tmp/nginx && \
45+ mkdir -p /var/tmp/nginx/client_body && \
46+ mkdir -p /var/log/supervisord
47+
48+ # Bootstrap files
49+ RUN touch /var/run/php-fpm.pid && \
50+ touch /var/run/nginx.pid && \
51+ touch /var/run/supervisord.pid
52+
53+ # Copy configs (PHP)
54+ COPY configs/php/php.ini /etc/php/php.ini
55+ COPY configs/php/php-fpm.conf /etc/php/php-fpm.conf
56+ COPY configs/php/php-fpm.d/www.conf /etc/php/php-fpm.d/www.conf
57+
58+ # Copy configs (Nginx)
59+ COPY configs/nginx/nginx.conf /etc/nginx/nginx.conf
60+ COPY configs/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
61+
62+ # Copy configs (Supervisor)
63+ COPY configs/supervisord/supervisord.conf /etc/supervisord/supervisord.conf
64+
65+ # Copy scripts
66+ COPY scripts/install_composer.sh /root
67+
68+ # Copy entrypoint script
69+ COPY scripts/entrypoint.sh /sbin/entrypoint.sh
70+
71+ # Change ownership
72+ RUN chown -R www:www /app && \
73+ chown -R www:www /var/run/php-fpm.pid && \
74+ chown -R www:www /var/run/nginx.pid && \
75+ chown -R www:www /var/run/supervisord.pid && \
76+ chown -R www:www /var/lib/nginx && \
77+ chown -R www:www /var/tmp/nginx && \
78+ chown -R www:www /var/log/supervisord
79+
80+ # Change permissions
81+ RUN chmod -R 755 /root/install_composer.sh && \
82+ chmod -R 770 /var/tmp/nginx && \
83+ chmod -R 770 /var/tmp/nginx/client_body && \
84+ chmod -R 755 /sbin/entrypoint.sh
85+
86+ # Install Composer
87+ ENV PATH="/root/.composer/vendor/bin:${PATH}"
88+ RUN cd /root && ./install_composer.sh 2.8.5
89+
90+ WORKDIR /app
91+
92+ EXPOSE 80
93+ CMD ["/sbin/entrypoint.sh" ]
0 commit comments