Dockerfile 1.03 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
FROM php:7.4-fpm-alpine

ENV PROJECT_DIR /var/www

# Set working directory
WORKDIR ${PROJECT_DIR}

# Install dependencies
RUN apk update && apk add --no-cache \
    alpine-sdk \
11
    postgresql-dev \
12
13
14
15
16
17
    zlib-dev \
    libpng-dev \
    shadow \
    bash \
    bash-completion \
    vim \
18
19
20
21
22
    npm\
    && apk add --no-cache $PHPIZE_DEPS \
    && npm install -g @vue/cli \
    && pecl install xdebug \
    && docker-php-ext-enable xdebug
23
24
25

# Install PHP Extensions
RUN docker-php-ext-install pdo \
26
    pdo_pgsql \
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
    bcmath \
    fileinfo \
    gd

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

# Add user for application and create source directories
RUN groupadd -g 1000 www && \
    useradd -u 1000 -ms /bin/bash -g www www

# Copy existing application directory permissions
COPY --chown=www:www src/web ${WORKDIR}
COPY php/dev.ini /usr/local/etc/php/conf.d/local.ini

# Change current user to www
USER www

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