-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (26 loc) · 1.41 KB
/
Copy pathDockerfile
File metadata and controls
35 lines (26 loc) · 1.41 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
FROM composer:latest as composer
WORKDIR /var/www
ADD ./src/ /var/www/
RUN test -d storage/framework/views || mkdir -p storage/framework/views \
&& test -d storage/framework/sessions || mkdir -p storage/framework/sessions \
&& test -d storage/framework/cache || mkdir -p storage/framework/cache \
&& test -d storage/logs || mkdir -p storage/logs && touch storage/logs/laravel.log \
&& composer install
FROM node:latest AS node
COPY --from=composer /var/www /var/www/
WORKDIR /var/www
RUN npm install && npm run build && rm -rf node_modules
FROM php:8.2.7-fpm-alpine
COPY --from=node /var/www /var/www
RUN docker-php-ext-install pdo_mysql && apk add --no-cache autoconf build-base nginx dcron redis supervisor \
&& pecl install redis && docker-php-ext-enable redis
COPY ./src/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./src/cron /etc/crontabs/root
COPY nginx/conf.d/app.conf /etc/nginx/conf.d/app.conf
COPY nginx/nginx.conf /etc/nginx/nginx.conf
RUN chmod 0644 /etc/crontabs/root \
&& chown -R www-data:www-data /var/www/public /var/www/storage /var/www/bootstrap/cache /var/lib/nginx \
&& chmod -R 755 /var/www/vendor /var/www/storage /var/www/bootstrap/cache /var/lib/nginx
WORKDIR /var/www
RUN rm -rf /var/www/html && apk del build-base && apk add --update-cache && rm -rf /var/cache/apk/*
CMD ["/usr/bin/supervisord", "--nodaemon", "-c", "/etc/supervisor/conf.d/supervisord.conf"]