forked from manualdousuario/marreta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (46 loc) · 1.51 KB
/
Dockerfile
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
# Stage 0: Base
FROM php:8.3-fpm AS base
# Install dependencies and extensions
RUN apt-get update && apt-get install -y \
nginx \
nano \
procps \
psmisc \
zip \
git \
htop \
libzip-dev \
libhiredis-dev \
&& docker-php-ext-install zip opcache \
&& pecl install redis \
&& docker-php-ext-enable redis opcache \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Stage 1: Build stage
FROM base AS builder
# Copy OPCache configuration
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy app folder
COPY app/ /app/
# Install composer packages
WORKDIR /app
RUN composer install --no-interaction --optimize-autoloader
# Stage 2: Final
FROM base
# Copy necessary files from the builder stage
COPY --from=builder /usr/local/etc/php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY --from=builder /usr/local/bin/composer /usr/local/bin/composer
COPY --from=builder /app /app
# Copy webservice configuration
COPY default.conf /etc/nginx/sites-available/default
# Copy and configure initialization script permissions
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Create cache and logs folders
RUN mkdir -p /app/cache /app/logs
# Configure base permissions for /app directory
RUN chown -R www-data:www-data /app \
&& chmod -R 755 /app
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]