-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDockerfile-nginx-dev
More file actions
101 lines (75 loc) · 3 KB
/
Dockerfile-nginx-dev
File metadata and controls
101 lines (75 loc) · 3 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
FROM php:8.2-fpm
# Install required PHP extensions
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
unzip \
git \
ffmpeg \
nginx \
cron \
vim \
# wkhtmltopdf \
#chromium \
#imagemagick \
#curl \
#gh \
#composer \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql zip opcache exif
# Install Imagick PHP extension
#RUN apt-get install -y libmagickwand-dev \
# && pecl install imagick \
# && docker-php-ext-enable imagick
#RUN sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read|write" pattern="PDF" \/>/' /etc/ImageMagick-6/policy.xml
# Install PHP dependencies
#RUN pecl install ffmpeg \
# && docker-php-ext-enable ffmpeg
#COPY ./nginx/basic.conf /etc/nginx/nginx.conf
#COPY ./nginx/basic.conf /etc/nginx/sites-available/basic.conf
#RUN ln -s /etc/nginx/sites-available/basic.conf /etc/nginx/sites-enabled/
# Copy Nginx site configuration files
#COPY ./nginx/development.conf /etc/nginx/conf.d/development.conf
#COPY ./nginx/basic.conf /etc/nginx/conf.d/basic.conf
# Ensure the configuration files have the correct permissions
#RUN chmod 644 /etc/nginx/conf.d/*.conf
# Create sites-available and sites-enabled directories if they don't exist
#RUN mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled
# Create symbolic links to enable the sites
#RUN ln -sf /etc/nginx/conf.d/development.conf /etc/nginx/sites-enabled/
#RUN ln -sf /etc/nginx/conf.d/basic.conf /etc/nginx/sites-enabled/
RUN ln -s /var/www/html ~/www
# Set working directory in the container
WORKDIR /var/www/html
# Copy application files to the container
COPY . /var/www/html
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Set permissions for the web server
#RUN chown -R www-data:www-data /var/www/html \
RUN chmod -R 775 /var/www/html
RUN cd /var/www/html
#RUN composer install
#COPY ./wait-for-it.sh /usr/local/bin/wait-for-it
#RUN chmod +x /usr/local/bin/wait-for-it
COPY ./cron/cronlist /etc/cron.d/cronlist
RUN chmod 0644 /etc/cron.d/cronlist
RUN crontab /etc/cron.d/cronlist
# Start cron service
RUN service cron start
#todo: not getting fired
#RUN ./init --env=Dev-Server-Nginx --overwrite=All
# copy php configuration
COPY ./nginx/php.conf /etc/nginx/php.conf
# load environment specific configuration
COPY ./nginx/development.conf /etc/nginx/sites-available/development.conf
RUN ln -s /etc/nginx/sites-available/development.conf /etc/nginx/sites-enabled/
# run default nginx config
RUN rm /etc/nginx/sites-enabled/default
# Expose port 80
EXPOSE 80
# Start Nginx and PHP-FPM
#CMD ["sh", "-c", "service nginx start && ./yii migrate && php-fpm"]
CMD ["sh", "-c", "composer install && ./init --env=Dev-Server-Nginx --overwrite=All && ./yii migrate --interactive=0 && service nginx restart && php-fpm && tail -f /dev/null"]