-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (33 loc) · 1.09 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
ARG COMPOSER_VERSION=lts
ARG PHP_VERSION=8.1-apache
# Stage 1: Build
FROM composer:${COMPOSER_VERSION} as build
WORKDIR /app
COPY . /app/
# Install dependencies
RUN composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction --no-progress
# Stage 2: Production
FROM php:${PHP_VERSION} as production
ENV APP_ENV=production
ENV APP_DEBUG=false
# Install Postgres driver
RUN apt-get update && \
apt-get install -y libpq-dev
# Install PHP extensions
RUN docker-php-ext-configure opcache --enable-opcache && \
docker-php-ext-install pdo pdo_mysql pdo_pgsql
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# Copy opcache config
COPY .docker/php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Copy application
COPY --from=build /app /var/www/html
# Copy apache config
COPY .docker/apache/vhost.conf /etc/apache2/sites-available/000-default.conf
# Copy entrypoint
COPY .docker/entrypoint.sh /entrypoint.sh
# Copy configure script
RUN chown -R www-data:www-data /var/www/ && \
a2enmod rewrite
EXPOSE 80
# Run Entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]