-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 877 Bytes
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 877 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
FROM php:8.3-cli
# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
libpq-dev \
unzip \
&& docker-php-ext-install \
pdo_pgsql \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Copy composer files
COPY composer.json composer.lock* ./
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Copy application files
COPY . .
# Create data directory and set permissions
RUN mkdir -p /var/www/html/data && \
chown -R www-data:www-data /var/www/html && \
chmod -R 755 /var/www/html/data
# Expose port 8000
EXPOSE 8000
# Switch to non-root user
USER www-data
# Start PHP built-in server
CMD ["php", "-S", "0.0.0.0:8000", "-t", "/var/www/html"]