diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..db27dc8 --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,2 @@ +.env +vendor \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..b063ea9 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,11 @@ +FROM openswoole/swoole:latest-alpine + +WORKDIR /var/www + +COPY . /var/www + +RUN composer install --working-dir=/var/www + +EXPOSE ${OPENSWOOLE_SERVER_PORT} + +CMD [ "php", "server.php" ] \ No newline at end of file diff --git a/backend/server.php b/backend/server.php index a332bd8..9fb888e 100644 --- a/backend/server.php +++ b/backend/server.php @@ -6,7 +6,7 @@ // Load .env file configurations using vlucas/phpdotenv library // and make them accessible via $_ENV $dotenv = Dotenv\Dotenv::createImmutable(__DIR__); -$dotenv->load(); +$dotenv->safeLoad(); // Initialize a new OpenSwoole HTTP Server using the "OPENSWOOLE_SERVER_HOST" // and "OPENSWOOLE_SERVER_PORT" variables from the .env file