-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (35 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
44 lines (35 loc) · 1.54 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
FROM php:8.4-fpm-alpine
WORKDIR /opt/laravel
EXPOSE 80
# Install additional packages
RUN apk --no-cache add supervisor nginx mariadb-client icu-dev icu-libs libzip-dev \
&& docker-php-ext-install pdo pdo_mysql intl zip
# Declare image volumes
VOLUME /opt/laravel/storage
# Define a health check
HEALTHCHECK --interval=30s --timeout=15s --start-period=15s --retries=5 CMD curl -f http://localhost/public/up || exit 1
# Copy conf.d files
COPY conf.d/supervisor/supervisord.conf /etc/supervisord.conf
COPY conf.d/php-fpm/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
COPY conf.d/php/php.ini /usr/local/etc/php/conf.d/php.ini
COPY conf.d/nginx/default.conf /etc/nginx/nginx.conf
# docker-php-ext-enable opcache sodium
# COPY conf.d/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Scheduler setup
# @TODO: nikola - https://dev.to/spiechu/how-to-run-laravel-scheduler-in-docker-container-d1p
RUN touch /var/log/cron.log
RUN echo "* * * * * /usr/local/bin/php /opt/laravel/artisan schedule:run >> /var/log/cron.log 2>&1" | crontab -
# Add the entrypoint
ADD entrypoint.sh /root/entrypoint.sh
RUN chmod +x /root/entrypoint.sh
ENTRYPOINT ["/root/entrypoint.sh"]
# Fetch composer from its docker image, and run it
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
COPY composer.json composer.lock ./
RUN composer install --no-interaction --no-scripts --optimize-autoloader --no-dev
ARG DOCKER_TAG
ENV APP_VERSION=$DOCKER_TAG
# Copy everything (respects .dockerignore)
COPY . .
RUN chown -R www-data:www-data ./ \
&& chmod -R 755 ./storage