forked from gathering/wannabe4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (50 loc) · 1.68 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
ARG PHP_VERSION
### Builder
FROM composer as Builder
ARG GIT_BRANCH
RUN echo "Building app from ${GIT_BRANCH:-prod} branch"
RUN apk add git
RUN git clone --single-branch --branch ${GIT_BRANCH:-prod} https://github.com/gathering/wannabe.git ./
# Remove lock file since it's currently configured only for PHP 5
RUN rm -f ./composer.lock
RUN composer install --no-interaction
# App
RUN chmod +x build/prepare.sh && build/prepare.sh
### Production
FROM php:${PHP_VERSION:-5}-fpm-alpine as production
RUN apk add --no-cache libpng libpng-dev libjpeg-turbo-dev libmcrypt-dev gettext gettext-dev
RUN docker-php-ext-configure gd \
--with-gd \
--with-jpeg-dir \
--with-png-dir
RUN docker-php-ext-install pdo pdo_mysql gd exif mcrypt gettext
COPY --from=builder /app/app /var/www/html/wannabe/app
COPY --from=builder /app/lib /var/www/html/wannabe/lib
COPY --from=builder /app/index.php /var/www/html/wannabe/index.php
### Development
FROM php:${PHP_VERSION:-5}-fpm as Development
RUN apt-get update && apt-get install -y \
mariadb-client \
python-dev \
python-pip \
python-mysqldb-dbg \
git \
vim \
man \
zip \
libpng-dev \
libjpeg-dev \
unzip
RUN docker-php-ext-configure gd \
--with-gd \
--with-jpeg-dir \
--with-png-dir
RUN docker-php-ext-install pdo pdo_mysql gd exif
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=builder /app /var/www/html/wannabe
COPY --from=builder /app/build/development-entrypoint.sh /usr/bin/development-entrypoint
COPY --from=builder /app/build/tooling-entrypoint.sh /usr/bin/tooling-entrypoint
RUN chmod a+x /usr/bin/development-entrypoint
RUN chmod a+x /usr/bin/tooling-entrypoint
ENTRYPOINT ["development-entrypoint"]
CMD ["php-fpm"]