-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (69 loc) · 1.8 KB
/
Dockerfile
File metadata and controls
88 lines (69 loc) · 1.8 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Build stage for Node.js assets
FROM node:20-alpine AS node-builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# PHP stage
FROM php:8.2-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
nginx \
supervisor \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
zip \
unzip \
icu-dev \
libxml2-dev \
oniguruma-dev \
curl-dev \
sqlite-dev
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
pdo_mysql \
pdo_sqlite \
zip \
bcmath \
intl \
xml \
mbstring \
curl \
opcache
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy application files
COPY . .
# Copy built assets from node stage
COPY --from=node-builder /app/public/build ./public/build
# Install Composer dependencies
RUN composer install --optimize-autoloader --no-dev --no-interaction --no-scripts
# Create necessary directories
RUN mkdir -p /var/log/supervisor \
&& mkdir -p /var/run \
&& mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \
&& mkdir -p storage/framework/cache \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache
# Set permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 775 /var/www/html/storage \
&& chmod -R 775 /var/www/html/bootstrap/cache
# Copy nginx configuration
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
# Copy supervisord configuration
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create startup script
COPY docker/start.sh /start.sh
RUN chmod +x /start.sh
# Railway uses dynamic ports
ENV PORT=80
EXPOSE ${PORT}
CMD ["/start.sh"]