From 8252ae4e53b1ff5aad8b4f90152d10d36ebc156a Mon Sep 17 00:00:00 2001 From: Ron Rise Date: Thu, 4 Dec 2025 10:05:51 -0500 Subject: [PATCH] fix: optimize Dockerfile by removing unnecessary build dependencies and improving healthcheck --- Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 885b972..7a0ff70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN if [ "$KAFKA_ENABLED" -eq 1 ] ; then \ echo "Kafka support enabled" ; \ apk add autoconf g++ librdkafka-dev make --no-cache ; \ pecl install rdkafka && docker-php-ext-enable rdkafka ; \ + apk del autoconf g++ make ; \ else \ echo "Kafka support disabled" ; \ exit 0 ; \ @@ -44,12 +45,16 @@ COPY --from=library /app/vendor /app/vendor ADD src src/ ADD generated generated/ ADD protos protos/ -ADD server.php . -ADD .rr.yaml . -ADD config.php . +ADD server.php cli.php grpc-worker.php .rr.yaml config.php ./ -EXPOSE 9501 -EXPOSE 9001 +EXPOSE 9501 9001 + +RUN addgroup -g 1000 appuser && adduser -D -u 1000 -G appuser appuser && chown -R appuser:appuser /app +USER appuser + +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \ + CMD curl -f http://localhost:9501/healthz || exit 1 # Entrypoint command to run the RoadRunner server with the specified configuration -ENTRYPOINT ["rr", "serve", "-c", ".rr.yaml", "-s"] \ No newline at end of file +ENTRYPOINT ["rr", "serve"] +CMD ["-c", ".rr.yaml", "-s"] \ No newline at end of file