Files
api/Dockerfile
T
2025-01-29 14:27:44 +01:00

45 lines
1.0 KiB
Docker

# Base image: PHP 8.2 with FPM
FROM php:8.2-fpm
# Install necessary system dependencies
RUN apt-get update && apt-get install -y \
git \
unzip \
libonig-dev \
libpq-dev \
libzip-dev \
libcurl4-openssl-dev \
default-mysql-client \
redis-server \
nginx \
&& docker-php-ext-install \
mysqli \
pdo \
pdo_mysql \
zip \
bcmath \
sockets
# Set working directory
WORKDIR /var/www/html
# Copy application code
COPY . /var/www/html
# Copy Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf
# Install Composer
COPY --from=composer:2.6 /usr/bin/composer /usr/bin/composer
# Install PHP dependencies through Composer
RUN composer install --no-dev --optimize-autoloader
# Set permissions for the web server
RUN chown -R www-data:www-data /var/www/html && chmod -R 755 /var/www/html
# Expose port 80 (HTTP) and 443 (HTTPS)
EXPOSE 80 443
# Start services (Nginx and Redis) when the container starts
CMD service redis-server start && nginx -g "daemon off;" && php-fpm