-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·42 lines (31 loc) · 929 Bytes
/
Dockerfile
File metadata and controls
executable file
·42 lines (31 loc) · 929 Bytes
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
# Build stage
FROM composer:latest AS build
WORKDIR /app
COPY . /app
RUN composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction
# Production stage
FROM php:8.3-fpm AS production
# Install system dependencies
RUN apt-get update && apt-get install -y \
nginx \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo pdo_pgsql
# Copy composer dependencies
COPY --from=build /app /var/www/html
# Configure nginx
COPY nginx.conf /etc/nginx/nginx.conf
# Set working directory
WORKDIR /var/www/html
# Create storage directory and set permissions
RUN mkdir -p /var/www/html/storage/logs \
&& chown -R www-data:www-data /var/www/html/storage \
&& chmod -R 775 /var/www/html/storage
# Copy .env file
COPY .env /var/www/html/.env
# Expose port 80
EXPOSE 80
# Start nginx and php-fpm
CMD service nginx start && php-fpm