-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a dockerfile to easily run the API
without having to install PHP or required dependencies
- Loading branch information
1 parent
a1c6a5c
commit 03ea14c
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* | ||
!src | ||
!i18n | ||
!jsondata | ||
!composer.json | ||
!composer.lock | ||
!LitCalTestServer.php | ||
!index.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Use the official PHP 8.3 CLI image as the base image | ||
FROM php:8.3-cli | ||
|
||
# Set the working directory | ||
WORKDIR /var/www/html | ||
|
||
# Install necessary PHP extensions | ||
RUN apt update -y && \ | ||
apt upgrade -y && \ | ||
apt install -y --no-install-recommends libicu-dev libonig-dev libzip-dev locales-all && \ | ||
docker-php-ext-configure intl && \ | ||
docker-php-ext-install intl mbstring zip && \ | ||
docker-php-ext-enable intl mbstring zip | ||
|
||
# Install Composer | ||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
# Copy the current directory contents into the container | ||
COPY . ./ | ||
|
||
# Set the environment variable | ||
ENV PHP_CLI_SERVER_WORKERS=2 | ||
|
||
# Run composer install to install dependencies | ||
RUN composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev | ||
|
||
# Expose port 8000 to the host | ||
EXPOSE 8000 | ||
|
||
# Command to run PHP's built-in server | ||
CMD ["php", "-S", "0.0.0.0:8000", "-t", "/var/www/html"] |