diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40b5efd..a266384 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: uses: docker/build-push-action@v5 with: context: ./ - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64,linux/arm64 push: false # tags: ghcr.io/edgebox-iot/api:${{ github.ref_name }},ghcr.io/edgebox-iot/api:latest test: diff --git a/Dockerfile b/Dockerfile index 38067da..4da36fe 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-apache-buster +FROM php:8.1-apache as php-base ARG DEBIAN_FRONTEND=noninteractive @@ -22,22 +22,17 @@ RUN apt-get -y update --fix-missing \ libfreetype6-dev \ libjpeg62-turbo-dev \ libpng-dev \ - && rm -rf /var/lib/apt/lists/* - - # Additional packages that might be removed - # libmagickwand-dev \ - -# Install PHP Extensions -RUN docker-php-ext-install \ - pdo_sqlite \ - mysqli \ - curl \ - zip \ - intl \ - mbstring \ - gettext \ - exif \ - gd + && rm -rf /var/lib/apt/lists/* \ + && docker-php-ext-install \ + pdo_sqlite \ + mysqli \ + curl \ + zip \ + intl \ + mbstring \ + gettext \ + exif \ + gd # Install additional PHP Extensions # RUN pecl install xdebug-3.2.0 \ @@ -47,19 +42,20 @@ RUN docker-php-ext-install \ # && pecl install imagick \ # && docker-php-ext-enable imagick -# Enable apache modules -# RUN a2enmod rewrite headers +FROM php-base as final -# Layering Composer binary COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer +COPY ./src/composer.json ./src/composer.lock ./ -# Add Source Code +# Copy application code (most frequently changed) COPY ./src /var/www/html ENV APP_ENV=prod -# Install Composer Dependencies RUN composer install --no-dev --optimize-autoloader # Cleanup RUN rm -rf /usr/src/* + +# Configure apache if needed +# RUN a2enmod rewrite headers \ No newline at end of file