-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.dockerfile
37 lines (30 loc) · 1.12 KB
/
production.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Stage 1: Install dependencies (Composer)
FROM composer:latest as stage1
WORKDIR /app
COPY . /app/
RUN composer install --no-dev --optimize-autoloader --ignore-platform-reqs
# Stage 2: Build UI
FROM node:alpine as stage2
COPY --from=stage1 /app /app
WORKDIR /app/ui
RUN yarn install \
&& yarn build \
&& mv dist/* /app/public \
&& mv /app/public/index.html /app/public/ui-index.html \
&& rm -rf /app/ui
# Stage 3: Service image
FROM php:7.4-apache
ENV APACHE_DOCUMENT_ROOT /app/public
WORKDIR /app
RUN apt-get update -y \
&& a2enmod rewrite \
&& apt-get -y install libpq-dev wait-for-it libyaml-dev \
&& docker-php-ext-install pdo pgsql pdo_pgsql sockets \
&& pecl install redis \
&& pecl install yaml \
&& docker-php-ext-enable redis yaml \
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
&& ln -s /app/docker/php.ini /usr/local/etc/php/conf.d/99-app.ini
COPY --from=stage2 /app /app
ENTRYPOINT ["/app/docker/entrypoint.sh"]