Update build configuration files

This commit is contained in:
Oliver Davies 2024-05-10 23:55:32 +02:00
parent e917e41d01
commit 13945dcaec
8 changed files with 180 additions and 23 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
/README.md

8
.env.example Normal file
View file

@ -0,0 +1,8 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
export DOCKER_UID=1000
export MYSQL_DATABASE=app
export MYSQL_PASSWORD=app
export MYSQL_USER=app

59
.gitignore vendored
View file

@ -1,27 +1,40 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
*
!*/
.editorconfig
.env
.gitattributes
.phpunit.result.cache
vendor/
web/.csslintrc
web/.eslintignore
web/.eslintrc.json
web/.ht.router.php
web/.htaccess
web/INSTALL.txt
web/README.md
web/autoload.php
web/core/
web/example.gitignore
web/index.php
web/modules/README.txt
web/modules/contrib/
web/profiles/README.txt
web/robots.txt
web/sites/*/files/
web/sites/*/private/
web/sites/*/services*.yml
web/sites/*/settings*.php
web/sites/README.txt
web/sites/default/default.services.yml
web/sites/default/default.settings.php
web/sites/development.services.yml
web/sites/example.settings.local.php
web/sites/example.sites.php
web/sites/simpletest/
web/themes/README.txt
web/themes/contrib/
web/update.php
web/web.config
!/.dockerignore
!/.env.example
!/.githooks/**
!/.github/**
!/.gitignore
!/.hadolint.yaml
!/Dockerfile
!/build.yaml
!/composer.{json,lock}
!/docker-compose.yaml
!/phpcs.xml.dist
!/phpstan.neon.dist
!/phpunit.xml.dist
!/run
!/run.local
!/tools/**
!/web/*/custom/**
!/_lessons/**
!/phpstan.neon
!/tests/**
.dir-env/

2
.hadolint.yaml Normal file
View file

@ -0,0 +1,2 @@
ignore:
- DL3059

53
Dockerfile Normal file
View file

@ -0,0 +1,53 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
FROM php: AS base
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN which composer && composer -V
ARG DOCKER_UID=1000
ENV DOCKER_UID="${DOCKER_UID}"
WORKDIR /app
RUN adduser --disabled-password --uid "${DOCKER_UID}" app \
&& chown app:app -R /app
USER app
ENV PATH="${PATH}:/app/bin:/app/vendor/bin"
COPY --chown=app:app composer.* ./
################################################################################
FROM base AS build
USER root
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
git libpng-dev libjpeg-dev libzip-dev mariadb-client unzip \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \
&& apt-get clean
RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-install gd opcache pdo_mysql zip
COPY --chown=app:app phpunit.xml* ./
USER app
COPY --chown=app:app tools/docker/images/php/root /
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"]
CMD ["php-fpm"]

69
docker-compose.yaml Normal file
View file

@ -0,0 +1,69 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
x-proxy: &default-proxy
networks:
- default
- web
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_proxy"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(
`${COMPOSE_PROJECT_NAME}.docker.localhost`,
)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.tls=true"
x-app: &default-app
volumes:
- "${DOCKER_WEB_VOLUME:-./web:/app/web}"
env_file:
- .env
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
networks:
- default
deploy:
resources:
limits:
cpus: "${DOCKER_MYSQL_CPUS:-0}"
memory: "${DOCKER_MYSQL_MEMORY:-0}"
labels:
- "traefik.enable=false"
tty: true
services:
php:
<<: [*default-app]
build:
context: .
target: build
args:
- "DOCKER_UID=${DOCKER_UID:-1000}"
volumes:
- .:/app
profiles: [php]
database:
image: :
deploy:
resources:
limits:
cpus: "${DOCKER_MYSQL_CPUS:-0}"
memory: "${DOCKER_MYSQL_MEMORY:-0}"
volumes:
- db-data:/var/lib/mysql
env_file:
- .env
labels:
- "traefik.enable=false"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
profiles: [database]
volumes:
db-data: {}
networks:
web:
external: true
name: traefik_proxy

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
[[ -f composer.json && ! -d vendor ]] && composer install
eval "$@"

View file

@ -0,0 +1,4 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
max_vars_input = 1000
memory_limit = 128M