This repository was archived by the owner on Sep 8, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (45 loc) · 1.61 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (45 loc) · 1.61 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
FROM php:8.2-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Copy composer files first to leverage Docker cache
COPY composer.json composer.lock ./
# Install dependencies
# Using --no-scripts to prevent errors before the application code is copied
RUN composer install --no-interaction --no-progress --no-scripts
# Copy the rest of the application files
COPY . .
# Run composer scripts now that the application code is present
RUN composer run-script post-autoload-dump
# Copy environment file
RUN cp .env.docker .env
# Set appropriate permissions for storage and bootstrap cache
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
RUN chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
RUN mkdir -p storage/framework/cache
RUN mkdir -p storage/framework/sessions
RUN mkdir -p storage/framework/views
RUN chmod -R 775 storage/framework/cache
RUN chmod -R 775 storage/framework/sessions
RUN chmod -R 775 storage/framework/views
# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set entrypoint
ENTRYPOINT ["entrypoint.sh"]
# Expose port and start server
EXPOSE 8000
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]