docker config COPY + EXPOSE

Читал гайд по созданию LEMP на докере, чтобы поправить косяки у себя, и увидел такой вот странный конфиг:

FROM php:7.2-fpm

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

# Set working directory
WORKDIR /var/www

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    mysql-client \
    libpng-dev \
    libjpeg62-turbo-dev \
    libfreetype6-dev \
    locales \
    zip \
    jpegoptim optipng pngquant gifsicle \
    vim \
    unzip \
    git \
    curl

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd

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

# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www

# Copy existing application directory contents
COPY . /var/www

# Copy existing application directory permissions
COPY --chown=www:www . /var/www

# Change current user to www
USER www

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]

А именно в нем копируется вся папка с проектом и делается expose 9000 порта для php-fpm. Но чем это отличается от моего, который тоже работает?

FROM php:7.3-fpm-stretch

RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y software-properties-common

RUN apt-get update && apt-get install -y wget gnupg2 libxml2-dev

COPY ./php.ini /usr/local/etc/php/

COPY ./locale.gen /etc/

RUN apt-get update && apt-get install -y \
    locales && locale-gen

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -

COPY ./google-chrome.list /etc/apt/sources.list.d

RUN apt-get update && apt-get install -y \
    google-chrome-stable \
    zlib1g-dev \
    libjpeg-dev\
    libpng-dev\
    libfreetype6-dev \
    libpq-dev \
    libicu-dev g++

RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

RUN docker-php-ext-install pgsql pdo_pgsql gd

RUN docker-php-ext-install soap

RUN apt-get update && apt-get install -y libc-client-dev libkrb5-dev && rm -r /var/lib/apt/lists/*
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
    && docker-php-ext-install imap

WORKDIR /var/www/html/trion

Ответы (0 шт):