-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (71 loc) · 2.3 KB
/
Dockerfile
File metadata and controls
91 lines (71 loc) · 2.3 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
89
90
91
# =============================================================================
# Multi-stage Dockerfile for Cooperative Bank Management System
# =============================================================================
# ---------- Stage 1: Build frontend assets ----------
FROM node:20-alpine AS frontend
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY vite.config.js ./
COPY resources/ resources/
RUN npm run build
# ---------- Stage 2: Install PHP dependencies ----------
FROM composer:2 AS composer
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --no-autoloader --prefer-dist
COPY . .
RUN composer dump-autoload --optimize
# ---------- Stage 3: Production image ----------
FROM php:8.4-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
nginx \
supervisor \
sqlite \
sqlite-dev \
libzip-dev \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
oniguruma-dev \
curl \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install \
pdo_sqlite \
pdo_mysql \
mbstring \
zip \
gd \
bcmath \
pcntl \
&& rm -rf /var/cache/apk/*
# Configure PHP
RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY docker/php.ini "$PHP_INI_DIR/conf.d/99-app.ini"
# Configure Nginx
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
# Configure Supervisor
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set working directory
WORKDIR /var/www/html
# Copy application code
COPY --from=composer /app /var/www/html
COPY --from=frontend /app/public/build /var/www/html/public/build
# Create required directories and set permissions
RUN mkdir -p \
storage/framework/cache/data \
storage/framework/sessions \
storage/framework/views \
storage/logs \
storage/app/private/kyc \
database \
bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache database \
&& chmod -R 775 storage bootstrap/cache database
# Copy entrypoint script
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]