-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (47 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
62 lines (47 loc) · 1.38 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
59
60
61
62
# Dockerfile for Laravel on Railway
FROM php:8.4-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
sqlite-dev \
nodejs \
npm
# Clear cache
RUN apk add --no-cache pcre-dev ${PHPIZE_DEPS} \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apk del pcre-dev ${PHPIZE_DEPS}
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd pdo_sqlite
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /app
# Copy composer files
COPY composer.json composer.lock ./
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader --no-interaction
# Copy application code
COPY . .
# Install Node dependencies and build assets
RUN npm install && npm run build
# Generate application key if not exists
RUN php artisan key:generate --no-interaction
# Set permissions
RUN chown -R www-data:www-data /app \
&& chmod -R 755 /app/storage \
&& chmod -R 755 /app/bootstrap/cache
# Create SQLite database if it doesn't exist
RUN touch /app/database/database.sqlite
# Run migrations and seeders
RUN php artisan migrate --force --seed
# Expose port
EXPOSE 8000
# Start Laravel server
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]