build-configs/templates/Dockerfile.twig

66 lines
1.5 KiB
Docker
Raw Normal View History

2023-01-19 19:47:15 +00:00
FROM php:{{ php.version }} AS base
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN which composer && composer -V
WORKDIR /app
ENV PATH="${PATH}:/app/vendor/bin"
COPY composer.* ./
{% if dockerfile.stages.build %}
################################################################################
FROM {{ dockerfile.stages.build.extends }} AS build
{% 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 %}
RUN {% for command in dockerfile.stages.build.commands %}
{% if not loop.first %} && {% endif %}
{{ command }}
2023-01-19 19:47:15 +00:00
{%- if not loop.last %} \{% endif %}
2023-01-19 19:47:15 +00:00
{% endfor %}
{% endif %}
2023-01-21 19:52:58 +00:00
COPY tools/docker/images/php/root /
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"]
CMD ["php-fpm"]
2023-01-19 19:47:15 +00:00
{% if dockerfile.stages.test %}
################################################################################
FROM {{ dockerfile.stages.test.extends }} AS test
COPY . .
RUN {% for command in dockerfile.stages.test.commands -%}
{% if not loop.first %} && {% endif %}
{{ command }}
2023-01-19 19:47:15 +00:00
{%- if not loop.last %} \{% endif %}
2023-01-19 19:47:15 +00:00
{% endfor %}
{% endif %}
{% if web.type == "nginx" %}
################################################################################
FROM nginx:1 as web
EXPOSE 8080
WORKDIR /app
COPY tools/docker/images/nginx/root /
{% endif %}