File tree Expand file tree Collapse file tree 4 files changed +14
-20
lines changed
Expand file tree Collapse file tree 4 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -87,14 +87,8 @@ RUN EXT_DIR=$(php-config --extension-dir) && \
8787COPY --from=builder /app/ext/modules/tokio_sapi.so /tmp/tokio_sapi.so
8888RUN EXT_DIR=$(php-config --extension-dir) && \
8989 cp /tmp/tokio_sapi.so "$EXT_DIR/" && \
90- rm /tmp/tokio_sapi.so /tmp/php_ext_dir
91-
92- # Copy PHP configuration (OPcache, JIT, tokio_sapi)
93- COPY php.ini /usr/local/etc/php/conf.d/tokio_php.ini
94-
95- # Enable preloading for dev image
96- RUN echo "opcache.preload=/var/www/html/preload.php" >> /usr/local/etc/php/conf.d/tokio_php.ini && \
97- echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/tokio_php.ini
90+ rm /tmp/tokio_sapi.so /tmp/php_ext_dir && \
91+ echo "extension=tokio_sapi.so" >> /usr/local/etc/php/conf.d/tokio_sapi.ini
9892
9993# Create app directory
10094WORKDIR /app
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ COPY build.rs ./
8383RUN RUSTFLAGS="-C target-feature=-crt-static" cargo build --release
8484
8585# =============================================================================
86- # Distribution stage - extract binaries and config
86+ # Distribution stage - extract binaries only
8787# =============================================================================
8888FROM scratch AS dist
8989
@@ -93,9 +93,6 @@ COPY --from=builder /app/target/release/tokio_php /tokio_php
9393# PHP extension
9494COPY --from=builder /app/ext/modules/tokio_sapi.so /tokio_sapi.so
9595
96- # PHP configuration
97- COPY php.ini /php.ini
98-
9996# =============================================================================
10097# Minimal runtime stage (default)
10198# =============================================================================
@@ -110,10 +107,8 @@ RUN apk add --no-cache libgcc
110107COPY --from=builder /app/ext/modules/tokio_sapi.so /tmp/tokio_sapi.so
111108RUN EXT_DIR=$(php-config --extension-dir) && \
112109 cp /tmp/tokio_sapi.so "$EXT_DIR/" && \
113- rm /tmp/tokio_sapi.so
114-
115- # Copy PHP configuration (OPcache, JIT, tokio_sapi)
116- COPY php.ini /usr/local/etc/php/conf.d/tokio_php.ini
110+ rm /tmp/tokio_sapi.so && \
111+ echo "extension=tokio_sapi.so" >> /usr/local/etc/php/conf.d/tokio_sapi.ini
117112
118113# Copy binary
119114COPY --from=builder /app/target/release/tokio_php /usr/local/bin/tokio_php
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ services:
4242 - REQUEST_TIMEOUT=${REQUEST_TIMEOUT:-2m}
4343 volumes :
4444 - ./www:/var/www/html:ro
45+ # PHP configuration (OPcache, JIT, etc.)
46+ - ./php.ini:/usr/local/etc/php/conf.d/tokio_php.ini:ro
4547 restart : unless-stopped
4648 healthcheck :
4749 test : ["CMD", "curl", "-sf", "http://localhost:9090/health"]
@@ -82,6 +84,7 @@ services:
8284 - REQUEST_TIMEOUT=${REQUEST_TIMEOUT:-2m}
8385 volumes :
8486 - ./www:/var/www/html:ro
87+ - ./php.ini:/usr/local/etc/php/conf.d/tokio_php.ini:ro
8588 - ./certs:/certs:ro
8689 restart : unless-stopped
8790 healthcheck :
Original file line number Diff line number Diff line change 11; tokio_php configuration
2+ ;
3+ ; Mount this file via docker-compose:
4+ ; volumes:
5+ ; - ./php.ini:/usr/local/etc/php/conf.d/tokio_php.ini:ro
26
37[opcache]
48opcache.enable = 1
@@ -10,13 +14,11 @@ opcache.validate_timestamps = 0
1014opcache.revalidate_freq = 0
1115opcache.jit_buffer_size = 64M
1216opcache.jit = tracing
13- ; Preloading - runs preload.php at startup to cache framework classes
17+
18+ ; Preloading - uncomment for frameworks (Laravel, Symfony)
1419; opcache.preload = /var/www/html/preload.php
1520; opcache.preload_user = www-data
1621
17- [tokio_sapi]
18- extension = tokio_sapi.so
19-
2022[Session]
2123session.save_path = /tmp
2224session.use_cookies = 1
You can’t perform that action at this time.
0 commit comments