docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

Sending emails, php:8.2.4 #1395

Closed ivose closed 1 year ago

ivose commented 1 year ago

Sending email with container

FROM php:8.2.4-fpm-alpine as php

# Install dependencies
RUN apk add --no-cache \
    curl \
    libzip-dev \
    zip \
    unzip \
    && docker-php-ext-install pdo_mysql \
    && docker-php-ext-install zip \
    && rm -rf /var/cache/apk/*

RUN apk update && apk upgrade --no-cache

##### What to install here, that it sends emails??????????? Can somebody give working example?
## $msg = "First line of text\nSecond line of text";
## $msg = wordwrap($msg,70);
## mail("my@email.com","My subject, laravel docker test",$msg);

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set working directory
WORKDIR /var/www/html

# Copy composer.json and composer.lock
COPY composer.json composer.lock ./

# Install dependencies
RUN composer install --prefer-dist --no-dev --no-scripts --no-progress --no-suggest

# Copy the rest of the application code
COPY . .

# Set file permissions for Laravel
RUN chown -R www-data:www-data storage bootstrap/cache

# Expose port 9000
EXPOSE 9000

# Start PHP-FPM
CMD ["php-fpm"]
tianon commented 1 year ago

Unfortunately, we do not have the bandwidth to provide in-depth integration/deployment/environment debugging or support here; these sorts of questions/requests would be more appropriately posted to a dedicated support forum, such as the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow.