# {{ managedText | raw }} FROM php:{{ php.version }} AS base COPY --from=composer:2 /usr/bin/composer /usr/bin/composer RUN which composer && composer -V ARG DOCKER_UID=1000 ENV DOCKER_UID="${DOCKER_UID}" WORKDIR /app RUN adduser --disabled-password --uid "${DOCKER_UID}" app \ && chown app:app -R /app USER app ENV PATH="${PATH}:/app/bin:/app/vendor/bin" COPY --chown=app:app composer.* ./ {% if dockerfile.stages.build %} ################################################################################ FROM {{ dockerfile.stages.build.extends }} AS build USER root {% if dockerfile.stages.build.packages %} RUN apt-get update -yqq \ && apt-get install -yqq --no-install-recommends \ {{ dockerfile.stages.build.packages | join(' ') }} {% endif %} {% if dockerfile.stages.build.extensions.install %} RUN docker-php-ext-install {{ dockerfile.stages.build.extensions.install | join(' ') }} {% endif %} {% if dockerfile.stages.build.extra_files %} COPY --chown=app:app {{ dockerfile.stages.build.extra_files | join(" ") }} ./ {% endif %} {% for directory in dockerfile.stages.build.extra_directories %} COPY --chown=app:app {{ directory }} {{ directory }} {% endfor %} USER app {% for command in dockerfile.stages.build.commands %} RUN {{ command }} {% endfor %} {% endif %} COPY --chown=app:app tools/docker/images/php/root / ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"] CMD ["php-fpm"] {% if dockerfile.stages.test %} ################################################################################ FROM {{ dockerfile.stages.test.extends }} AS test COPY --chown=app:app . . RUN {% for command in dockerfile.stages.test.commands -%} {% if not loop.first %} && {% endif %} {{ command }} {%- if not loop.last %} \{% endif %} {% endfor %} {% endif %} {% if web.type == "caddy" %} ################################################################################ FROM caddy:2 as web WORKDIR /app COPY tools/docker/images/web/root / {% endif %} {% if web.type == "nginx" %} ################################################################################ FROM nginx:1 as web EXPOSE 8080 WORKDIR /app COPY tools/docker/images/web/root / {% endif %}