forked from relaticle/relaticle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (78 loc) · 2.61 KB
/
Dockerfile
File metadata and controls
101 lines (78 loc) · 2.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
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
92
93
94
95
96
97
98
99
100
101
# syntax=docker/dockerfile:1
###########################################
# Stage 1: Composer dependencies
###########################################
FROM composer:2 AS composer
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install \
--no-dev \
--no-interaction \
--no-scripts \
--no-autoloader \
--prefer-dist \
--ignore-platform-reqs
###########################################
# Stage 2: Build frontend assets
###########################################
FROM node:22-alpine AS frontend
WORKDIR /app
# Copy package files and install
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
# Copy source files needed for build
COPY vite.config.js ./
COPY resources ./resources
COPY public ./public
COPY app-modules ./app-modules
# Copy vendor for Filament theme CSS
COPY --from=composer /app/vendor ./vendor
RUN npm run build
###########################################
# Stage 3: Production image
###########################################
FROM serversideup/php:8.4-fpm-nginx AS production
LABEL org.opencontainers.image.title="Relaticle CRM"
LABEL org.opencontainers.image.description="Modern, open-source CRM platform"
LABEL org.opencontainers.image.source="https://github.com/Relaticle/relaticle"
# Switch to root to install dependencies
USER root
# Install required PHP extensions
RUN install-php-extensions intl exif gd imagick bcmath
# Install PostgreSQL client for health checks
RUN apt-get update \
&& apt-get install -y --no-install-recommends postgresql-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Switch back to www-data
USER www-data
WORKDIR /var/www/html
# Copy application source
COPY --chown=www-data:www-data . .
# Copy vendor from composer stage
COPY --chown=www-data:www-data --from=composer /app/vendor ./vendor
# Copy built frontend assets
COPY --chown=www-data:www-data --from=frontend /app/public/build ./public/build
# Generate optimized autoloader
RUN composer dump-autoload --optimize --no-dev
# Create storage directories
RUN mkdir -p \
storage/app/public \
storage/framework/cache/data \
storage/framework/sessions \
storage/framework/views \
storage/logs \
bootstrap/cache
# Default environment for serversideup/php Laravel automations
ENV AUTORUN_ENABLED=true
ENV AUTORUN_LARAVEL_STORAGE_LINK=true
ENV AUTORUN_LARAVEL_MIGRATION=true
ENV AUTORUN_LARAVEL_MIGRATION_ISOLATION=true
ENV AUTORUN_LARAVEL_CONFIG_CACHE=true
ENV AUTORUN_LARAVEL_ROUTE_CACHE=true
ENV AUTORUN_LARAVEL_VIEW_CACHE=true
ENV AUTORUN_LARAVEL_EVENT_CACHE=true
ENV AUTORUN_LARAVEL_OPTIMIZE=false
ENV PHP_OPCACHE_ENABLE=1
ENV SSL_MODE=off
EXPOSE 8080