feat: escape PHP_ERROR_REPORTING value in Dockerfile

Escapes the value of the PHP_ERROR_REPORTING environment variable in the Dockerfile to prevent potential issues with shell interpretation. Uses EnvBuilder for a more structured approach.
This commit is contained in:
Jean-Gabriel Gill-Couture 2025-04-27 15:55:12 -04:00
parent 16a665241e
commit f17948397f

View File

@ -101,8 +101,8 @@ impl<T: Topology + K8sclient> Interpret<T> for LAMPInterpret {
} }
} }
use dockerfile_builder::Dockerfile;
use dockerfile_builder::instruction::{CMD, COPY, ENV, EXPOSE, FROM, RUN, WORKDIR}; use dockerfile_builder::instruction::{CMD, COPY, ENV, EXPOSE, FROM, RUN, WORKDIR};
use dockerfile_builder::{Dockerfile, instruction_builder::EnvBuilder};
use std::fs; use std::fs;
impl LAMPInterpret { impl LAMPInterpret {
@ -126,9 +126,13 @@ impl LAMPInterpret {
// Set environment variables for PHP configuration // Set environment variables for PHP configuration
dockerfile.push(ENV::from("PHP_MEMORY_LIMIT=256M")); dockerfile.push(ENV::from("PHP_MEMORY_LIMIT=256M"));
dockerfile.push(ENV::from("PHP_MAX_EXECUTION_TIME=30")); dockerfile.push(ENV::from("PHP_MAX_EXECUTION_TIME=30"));
dockerfile.push(ENV::from( dockerfile.push(
"PHP_ERROR_REPORTING=E_ERROR | E_WARNING | E_PARSE", EnvBuilder::builder()
)); .key("PHP_ERROR_REPORTING")
.value("\"E_ERROR | E_WARNING | E_PARSE\"")
.build()
.unwrap(),
);
// Install necessary PHP extensions and dependencies // Install necessary PHP extensions and dependencies
dockerfile.push(RUN::from( dockerfile.push(RUN::from(