new docker image

This commit is contained in:
Pablo Ferreiro 2023-07-26 21:41:37 +02:00
parent 15fdd41cad
commit 4f906ef801
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
6 changed files with 33 additions and 38 deletions

View file

@ -1,25 +1,22 @@
FROM php:8.2-apache
WORKDIR /var/www/html
FROM trafex/php-nginx:latest
# Add composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apt update -y && apt upgrade -y \
&& apt install -y --no-install-recommends libzip-dev \
&& pecl install redis zip \
&& docker-php-ext-enable redis zip \
&& a2enmod rewrite headers \
&& mkdir /cache \
&& chown -R www-data:www-data /cache \
&& rm -rf /var/www/html/*
# Copy project to /var/www/html
COPY . .
# Copy config
COPY ./misc/setup/docker/php.ini /etc/php81/conf.d/settings.ini
# Run composer and clean
RUN composer update --no-cache \
&& composer install --no-interaction --optimize-autoloader --no-dev --no-cache \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/bin/composer
USER root
# Create cache folder
RUN mkdir /cache && chown -R nobody:nogroup /cache
# Install deps
RUN apk add --no-cache php81-redis php81-zip php81-tokenizer
USER nobody
EXPOSE 80
CMD apachectl -D FOREGROUND
# Copy source
COPY --chown=nobody . /var/www/html
# Dependencies
RUN composer install --no-interaction --optimize-autoloader --no-dev --no-cache
EXPOSE 8080