Add missing build configuration files

This commit is contained in:
Oliver Davies 2024-07-31 20:46:02 +01:00
parent 8d1a3b2d91
commit e526a47389
11 changed files with 129 additions and 17 deletions

View file

@ -1 +1,2 @@
/README.md
/.github/

View file

@ -2,6 +2,12 @@
export DOCKER_UID=1000
export COMPOSE_PROJECT_NAME=atdc
export COMPOSE_PROFILES=web,php,database
export DOCKER_WEB_VOLUME=.:/app
export DRUSH_OPTIONS_URI="https://${COMPOSE_PROJECT_NAME}.docker.localhost"
export MYSQL_DATABASE=app
export MYSQL_PASSWORD=app

9
.githooks/pre-push Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
set -o errexit
export TTY="-T"
./run test:commit

25
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: CI
on:
pull_request:
push:
workflow_dispatch:
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_UID: 1001
jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Build and test
run: |
./run ci:test

4
.gitignore vendored
View file

@ -36,5 +36,7 @@ web/themes/contrib/
web/update.php
web/web.config
# Docker.
.env
docker-compose.override.yaml
.dir-env/

View file

@ -1,6 +1,6 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
FROM php: AS base
FROM php:8.2-fpm-bullseye AS base
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN which composer && composer -V
@ -42,6 +42,8 @@ COPY --chown=app:app phpunit.xml* ./
USER app
RUN composer validate --strict
RUN composer install
COPY --chown=app:app tools/docker/images/php/root /
@ -51,3 +53,12 @@ CMD ["php-fpm"]
################################################################################
FROM nginx:1 as web
EXPOSE 8080
WORKDIR /app
COPY tools/docker/images/web/root /

View file

@ -2,18 +2,43 @@
name: atdc
template: drupal
parameters:
flake:
devshell:
packages:
- php82
- php82Packages.composer
web:
type: nginx
git:
ignore:
- '!/_lessons/**'
- '!/phpstan.neon'
- '!/tests/**'
database:
type: mariadb
version: 10
php:
version: 8.2-fpm-bullseye
phpcs:
paths:
- web/modules/custom
standards:
- Drupal
- DrupalPractice
phpstan:
level: max
paths:
- web/modules/custom
drupal:
docroot: web
docker-compose:
services:
- database
- php
- web
dockerfile:
stages:
build:
commands:
- composer validate --strict
- composer install
experimental:
createTmuxStartupFile: true
createInclusiveGitIgnoreFile: true
createGitHubActionsConfiguration: true
runGitHooksBeforePush: true
useNewDatabaseCredentials: true

View file

@ -30,6 +30,14 @@ x-app: &default-app
tty: true
services:
web:
<<: [*default-proxy, *default-app]
build:
context: .
target: web
depends_on:
- php
profiles: [web]
php:
<<: [*default-app]
@ -40,10 +48,12 @@ services:
- "DOCKER_UID=${DOCKER_UID:-1000}"
volumes:
- .:/app
depends_on:
- database
profiles: [php]
database:
image: :
image: mariadb:10
deploy:
resources:
limits:

View file

@ -4,6 +4,7 @@
<ruleset name="atdc coding standards">
<description>PHPCS configuration file for atdc.</description>
<file>web/modules/custom</file>
<arg value="np"/>

View file

@ -1,9 +1,9 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
parameters:
level:
level: max
excludePaths:
- *Test.php
- *TestBase.php
paths:
- web/modules/custom

View file

@ -0,0 +1,22 @@
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
server {
server_name _;
root /app/web;
location / {
try_files $uri /index.php?$query_string;
}
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
fastcgi_pass php:9000;
}
}