-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Dockerfile
72 lines (47 loc) · 1.94 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM php:7.4-fpm as build
WORKDIR /var/www
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
ENV COMPOSER_CACHE_DIR /dev/null
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apt-get -y update && \
apt-get install -y --no-install-recommends libzip-dev libpng-dev libicu-dev libmagickwand-dev zlib1g-dev nginx && \
apt-get clean all
RUN pecl install imagick && \
docker-php-ext-install -j$(nproc) opcache bcmath mysqli pdo pdo_mysql intl gd zip && \
docker-php-ext-enable opcache bcmath mysqli pdo pdo_mysql intl gd zip imagick
ENV PHP_OPCACHE_ENABLE=1
COPY --chown=www-data:www-data . /var/www
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN composer install \
--optimize-autoloader \
--no-interaction \
--no-plugins \
--no-dev \
--prefer-dist
EXPOSE 8080
##################################### assets_builder stage #############
## Build nodejs files ##
FROM node:16-alpine as assets_builder
COPY . /app
RUN cd app && \
npm ci --no-audit --ignore-scripts --no-fund && \
npm run production
###################################### prod stage ######################
FROM build as prod
ARG S6_OVERLAY_VERSION=3.1.2.1
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
ENTRYPOINT ["/init"]
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
COPY docker/php/php.ini /usr/local/etc/php/php.ini
COPY docker/php/www.conf /usr/local/etc/php-fpm.d/zz-docker.conf
COPY docker/s6-rc.d /etc/s6-overlay/s6-rc.d
COPY --chown=www-data:www-data --from=assets_builder /app/public/ ./public/
ENV APP_ENV production
ENV APP_DEBUG false
ENV LOG_CHANNEL stderr
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME 0
EXPOSE 80