-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
46 lines (34 loc) · 1.01 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
FROM php:8.4-cli
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y \
git \
curl \
libzip-dev \
unzip \
&& docker-php-ext-configure zip \
&& docker-php-ext-install -j$(nproc) \
mysqli \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Configure PHP
RUN echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/memory-limit.ini \
&& echo "max_execution_time = 300" >> /usr/local/etc/php/conf.d/execution-time.ini
COPY composer.json composer.lock ./
RUN composer install \
--no-dev \
--no-scripts \
--no-autoloader \
--prefer-dist
COPY . .
# Create required directories and set permissions
RUN mkdir -p var/cache var/log data \
&& chown -R www-data:www-data var data \
&& chmod -R 755 var data
# Complete composer installation with autoloader
RUN composer dump-autoload --optimize --no-dev
USER www-data
RUN touch .env
EXPOSE 8000
CMD ["php","-S","0.0.0.0:8000"]