Skip to content

Commit

Permalink
Include test result for Dockerfile generated for laravel 10 using oct…
Browse files Browse the repository at this point in the history
…ane roadrunner
  • Loading branch information
Kathryn Anne S Tan committed Jul 21, 2024
1 parent 21fa6fd commit 46aa6e3
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions tests/Feature/Supported/10_octane_rr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,61 @@

ARG PHP_VERSION=8.2
ARG NODE_VERSION=18
FROM fideloper/fly-laravel:${PHP_VERSION} as base
FROM ubuntu:22.04 as base
LABEL fly_launch_runtime="laravel"

# PHP_VERSION needs to be repeated here
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION
ENV DEBIAN_FRONTEND=noninteractive \
COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_HOME=/composer \
COMPOSER_MAX_PARALLEL_HTTP=24 \
PHP_PM_MAX_CHILDREN=10 \
PHP_PM_START_SERVERS=3 \
PHP_MIN_SPARE_SERVERS=2 \
PHP_MAX_SPARE_SERVERS=4 \
PHP_DATE_TIMEZONE=UTC \
PHP_DISPLAY_ERRORS=Off \
PHP_ERROR_REPORTING=22527 \
PHP_MEMORY_LIMIT=256M \
PHP_MAX_EXECUTION_TIME=90 \
PHP_POST_MAX_SIZE=100M \
PHP_UPLOAD_MAX_FILE_SIZE=100M \
PHP_ALLOW_URL_FOPEN=Off

LABEL fly_launch_runtime="laravel"
# Prepare base container:
# 1. Install PHP, Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY .fly/php/ondrej_ubuntu_php.gpg /etc/apt/trusted.gpg.d/ondrej_ubuntu_php.gpg
ADD .fly/php/packages/${PHP_VERSION}.txt /tmp/php-packages.txt

RUN apt-get update \
&& apt-get install -y --no-install-recommends gnupg2 ca-certificates git-core curl zip unzip \
rsync vim-tiny htop sqlite3 nginx supervisor cron \
&& ln -sf /usr/bin/vim.tiny /etc/alternatives/vim \
&& ln -sf /etc/alternatives/vim /usr/bin/vim \
&& echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list \
&& apt-get update \
&& apt-get -y --no-install-recommends install $(cat /tmp/php-packages.txt) \
&& ln -sf /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm \
&& mkdir -p /var/www/html/public && echo "index" > /var/www/html/public/index.php \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

# copy application code, skipping files based on .dockerignore
# 2. Copy config files to proper locations
COPY .fly/nginx/ /etc/nginx/
COPY .fly/fpm/ /etc/php/${PHP_VERSION}/fpm/
COPY .fly/supervisor/ /etc/supervisor/
COPY .fly/entrypoint.sh /entrypoint
COPY .fly/start-nginx.sh /usr/local/bin/start-nginx
RUN chmod 754 /usr/local/bin/start-nginx

# 3. Copy application code, skipping files based on .dockerignore
COPY . /var/www/html
WORKDIR /var/www/html

# 4. Setup application dependencies
RUN composer install --optimize-autoloader --no-dev \
&& mkdir -p storage/logs \
&& php artisan optimize:clear \
Expand All @@ -29,6 +73,7 @@ RUN rm -rf /etc/supervisor/conf.d/fpm.conf; \
ln -sf /etc/nginx/sites-available/default-octane /etc/nginx/sites-enabled/default;



# Multi-stage build: Build static assets
# This allows us to not include Node within the final container
FROM node:${NODE_VERSION} as node_modules_go_brrr
Expand Down Expand Up @@ -77,4 +122,7 @@ RUN rsync -ar /var/www/html/public-npm/ /var/www/html/public/ \
&& rm -rf /var/www/html/public-npm \
&& chown -R www-data:www-data /var/www/html/public

# 5. Setup Entrypoint
EXPOSE 8080

ENTRYPOINT ["/entrypoint"]

0 comments on commit 46aa6e3

Please sign in to comment.