drone config to build a base php image

This commit is contained in:
Julien Fastré 2022-06-07 10:16:24 +02:00
parent cc4152a99d
commit e758978c48
3 changed files with 112 additions and 1 deletions

26
.drone.yml Normal file
View File

@ -0,0 +1,26 @@
---
kind: pipeline
type: docker
name: build-base-image
image_pull_secrets:
- dockerconfig
trigger:
event:
- cron
cron:
- base-image
steps:
- name: build-base-image
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: chill/base-image
tag: latest
target: chill_base_php
pull_image: true
cache_from:
- chill/base-image:latest

82
Dockerfile Normal file
View File

@ -0,0 +1,82 @@
FROM php:7.4-fpm-buster AS chill_base_php
ENV POSTGRES_VERSION 14
# default UID for the PHP user
ARG UID=1000
ARG GID=1000
RUN apt update && apt -y --no-install-recommends install wget gnupg \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt update && apt -y --no-install-recommends install \
libicu-dev \
g++ \
postgresql-server-dev-$POSTGRES_VERSION \
libzip-dev libzip4 unzip \
libfreetype6-dev \
libonig-dev `# install oniguruma, required for mbstring` \
libpng-dev \
libjpeg62-turbo-dev \
git \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install intl pdo_pgsql mbstring zip bcmath sockets exif \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apt remove -y wget libicu-dev g++ gnupg libzip-dev \
&& apt autoremove -y \
&& apt purge -y
RUN { \
echo ""; \
echo "memory_limit = 512M"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/memory_limit.ini
RUN { \
echo ""; \
echo "[Date]"; \
echo "date.timezone = Europe/Brussels"; \
echo ""; \
} >> /usr/local/etc/php/conf.d/date.ini
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_MEMORY_LIMIT=-1
WORKDIR /var/www/app
CMD ["php-fpm"]
FROM chill_base_php AS chill_php
# copy directories
COPY ./bin /var/www/app/bin/.
COPY ./composer.* /var/www/app/
COPY ./config /var/www/app/config/.
COPY ./migrations /var/www/app/migrations/.
COPY ./public /var/www/app/public/.
COPY ./src /var/www/app/src/.
COPY ./templates /var/www/app/templates/.
COPY ./translations /var/www/app/translations/.
COPY ./vendor /var/www/app/vendor/.
COPY ./.env /var/www/app/.env
# import the manifest.json file
COPY ./public/build/manifest.json /var/www/app/public/build/manifest.json
ADD ./entrypoint.sh /.
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENV PHP_FPM_USER=www-data \
PHP_FPM_GROUP=www-data \
COMPOSER_HOME=/var/www/app/.composer \
SESSION_LIFETIME=10800
CMD [ "php-fpm" ]

View File

@ -1,2 +1,5 @@
# chill-recipe # Recipe for installing Chill (wip)
Currently, contains only tools to build a base image.