Skip to content

Commit

Permalink
Laravel ready 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddehs committed Oct 4, 2022
1 parent 15dba68 commit a71134b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea/
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ WORKDIR /var/www/html
RUN apk add --no-cache \
curl \
nginx \
redis \
php81 \
php81-ctype \
php81-curl \
Expand All @@ -17,15 +18,22 @@ RUN apk add --no-cache \
php81-gd \
php81-intl \
php81-mbstring \
php81-mysqli \
php81-pgsql \
php81-opcache \
php81-openssl \
php81-phar \
php81-session \
php81-xml \
php81-xmlreader \
php81-xmlwriter \
php81-fileinfo \
php81-simplexml \
php81-tokenizer \
php81-exif \
php81-pcntl \
php81-posix \
php81-redis \
supervisor

# Create symlink so programs depending on `php` still function
RUN ln -s /usr/bin/php81 /usr/bin/php

Expand All @@ -45,9 +53,6 @@ RUN chown -R nobody.nobody /var/www/html /run /var/lib/nginx /var/log/nginx
# Switch to use a non-root user from here on
USER nobody

# Add application
COPY --chown=nobody src/ /var/www/html/

# Expose the port nginx is reachable on
EXPOSE 8080

Expand All @@ -56,3 +61,6 @@ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

# Configure a healthcheck to validate that everything is up&running
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping

# Install composer from the official image
COPY --from=composer /usr/bin/composer /usr/bin/composer
4 changes: 3 additions & 1 deletion config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ http {
tcp_nodelay on;
absolute_redirect off;

root /var/www/html;
root /var/www/html/public;
index index.php index.html;

location / {
Expand All @@ -53,6 +53,8 @@ http {
root /var/lib/nginx/html;
}

client_max_body_size 100M;

# Pass the PHP scripts to PHP-FPM listening on php-fpm.sock
location ~ \.php$ {
try_files $uri =404;
Expand Down

0 comments on commit a71134b

Please sign in to comment.