-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 1.03 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
# Build stage
FROM php:8.4-fpm-alpine
# Install system dependencies & PHP extensions
RUN apk add --no-cache \
sqlite-dev \
curl-dev \
git \
unzip \
&& docker-php-ext-install pdo pdo_sqlite curl
# Set working directory
WORKDIR /var/www/html
# Install Composer from official image
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy only composer files first for better caching
COPY composer.json composer.lock* ./
# Install dependencies
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist
# Copy the rest of the application
COPY . .
# Finish composer (autoload and scripts)
RUN composer install --no-dev --optimize-autoloader
# Setup storage structure and permissions
RUN mkdir -p storage/database storage/sessions storage/logs \
&& chown -R www-data:www-data storage \
&& chmod -R 775 storage
# Entrypoint to handle runtime permissions
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["php-fpm"]