forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (58 loc) · 1.92 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
72
73
74
75
76
77
78
FROM php:7-apache AS builder
ARG COMPOSER=composer-es2x.json
WORKDIR /app
RUN apt-get update && \
apt-get -y install git sqlite3 gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
RUN apt-get -y install unzip nodejs
RUN npm install -g grunt-cli bower
COPY . .
RUN COMPOSER=${COMPOSER} composer install --no-dev --ignore-platform-reqs --optimize-autoloader
RUN npm install
RUN bower --allow-root install
RUN grunt prod
WORKDIR /data
RUN sqlite3 /data/data.db < /app/db.sql
RUN ln -sf /data/data.db /app/data.db
RUN cp /app/config_example.php /data/config.php
RUN sed -i 's/localhost:9200/es:9200/g' /data/config.php
RUN ln -sf /data/config.php /app/config.php
RUN cp /app/411.conf /data/411.conf
RUN sed -i 's/HOSTNAME/fouroneone/g' /data/411.conf
RUN sed -i 's/# SetEnv FOURONEONEHOST/SetEnv FOURONEONEHOST/g' /data/411.conf
RUN sed -i 's$/var/www/411$/app$g' /data/411.conf
RUN cp /app/docker/supervisord.conf /data/supervisord.conf
RUN cp /app/docker/mail.ini /data/mail.ini
RUN cp /app/docker/411_cron /data/411_cron
RUN /app/docker/init.php
RUN rm -rf /app/docker
FROM php:7-apache
WORKDIR /app
RUN chown www-data:www-data .
RUN apt-get update && \
apt-get -y install \
libxml2-dev \
libcurl4-openssl-dev \
sqlite3 \
libsqlite3-dev \
cron \
supervisor
RUN docker-php-ext-configure \
pdo_mysql --with-pdo-mysql=mysqlnd
RUN docker-php-ext-install \
xml \
pdo_mysql \
pdo_sqlite \
mbstring \
curl \
pcntl
RUN a2enmod headers rewrite
COPY --chown=www-data --from=builder /app .
COPY --chown=www-data --from=builder /data /data
RUN ln -sf /data/411.conf /etc/apache2/sites-available/000-default.conf
RUN ln -sf /data/mail.ini /usr/local/etc/php/conf.d/
RUN ln -sf /data/411_cron /etc/cron.d/
VOLUME /data
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/data/supervisord.conf"]