diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..29065e8 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,58 @@ +name: "Docker" + +on: + workflow_dispatch: + + push: + branches: ["master"] + + pull_request: + +permissions: + contents: read + +jobs: + test: + name: "Test" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v3 + + - name: "Build images" + run: "make build" + + - name: "Test images" + run: "make test" + + build: + name: "Build" + runs-on: "ubuntu-latest" + needs: ["test"] + + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Set up Docker Buildx" + uses: docker/setup-buildx-action@v3 + + - name: "Build web image" + uses: docker/build-push-action@v6 + with: + context: "." + file: "web/Dockerfile" + push: false + tags: "drupalista/web:latest" + + - name: "Build Redis image" + uses: docker/build-push-action@v6 + with: + context: "." + file: "redis/Dockerfile" + push: false + tags: "drupalista/redis:latest" diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..04fbe7c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,33 @@ +# AGENTS.md + +## Project + +Dockette Drupalista is a legacy Dockerized Drupal stack. It builds two local images, `drupalista/web:latest` and `drupalista/redis:latest`, and runs them with PostgreSQL and Adminer through Docker Compose. + +## Images + +- Web image: `drupalista/web:latest` from `web/Dockerfile`. +- Redis image: `drupalista/redis:latest` from `redis/Dockerfile`. +- The web image is based on `thecodingmachine/php:7.4-v3-slim-apache`; treat PHP 7.4 and the listed extensions as legacy constraints. +- The Redis image is based on `redis:5` and adds `redis/redis.conf` for the Unix socket setup used by the Drupal stack. + +## Commands + +- `make build` builds both local images. +- `make test` validates the compose file and runs non-interactive PHP/Redis version smoke checks against the built images. +- `make run` starts the compose stack locally. +- `make -n build test run` dry-runs the command wiring without requiring Docker. + +## Testing Notes + +- Run `docker compose config` after compose changes. +- Run `make test` after Dockerfile, Makefile, or compose changes when Docker is available. +- The smoke tests expect `make build` to have built the local images first. + +## Guidelines + +- Keep the legacy Drupal constraints documented; do not modernize PHP, Redis, PostgreSQL, or image names unless the task explicitly requires it. +- Prefer `DOCKER_*` Makefile variable names for Docker images and clear direct names for compose variables. +- Place `.PHONY: ` directly above every Makefile target. +- Do not add Slack badges. +- Avoid publishing a `dockette/drupalista` image unless the repository is changed to build that image intentionally. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Makefile b/Makefile index f4b4393..64a07dd 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,33 @@ -.PHONY: build +DOCKER_WEB_IMAGE?=drupalista/web +DOCKER_REDIS_IMAGE?=drupalista/redis +DOCKER_TAG?=latest +COMPOSE_FILE?=docker-compose.yml +.PHONY: build build: build-web build-redis +.PHONY: build-web build-web: - docker build -t drupalista/web -f web/Dockerfile . + docker build -t ${DOCKER_WEB_IMAGE}:${DOCKER_TAG} -f web/Dockerfile . + +.PHONY: test +test: + docker compose -f ${COMPOSE_FILE} config + docker run --rm ${DOCKER_WEB_IMAGE}:${DOCKER_TAG} php -v + docker run --rm ${DOCKER_REDIS_IMAGE}:${DOCKER_TAG} redis-server --version +.PHONY: test-web test-web: - docker run -it --rm drupalista/web bash + docker run --rm ${DOCKER_WEB_IMAGE}:${DOCKER_TAG} php -v +.PHONY: build-redis build-redis: - docker build -t drupalista/redis -f redis/Dockerfile . + docker build -t ${DOCKER_REDIS_IMAGE}:${DOCKER_TAG} -f redis/Dockerfile . + +.PHONY: test-redis +test-redis: + docker run --rm ${DOCKER_REDIS_IMAGE}:${DOCKER_TAG} redis-server --version + +.PHONY: run +run: + docker compose -f ${COMPOSE_FILE} up diff --git a/README.md b/README.md index 8bcdc97..4804956 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@

Dockette / Drupalista

- 🐳 Dockerized Drupal Stack + GitHub Actions + GitHub Sponsors + Support/Discussions +

+ +

+ 🐳 Dockerized Drupal Stack

@@ -12,68 +18,26 @@ ## Usage +This is a legacy Drupal stack. The baseline intentionally keeps PHP 7.4, Redis 5 and PostgreSQL 12 aligned with the original runtime instead of modernizing the application stack. + This stack is composed from these images: - `drupalista/web` - Based on `thecodingmachine/php:7.4-v3-slim-apache` - - PHP: amqp, apcu, ast, bcmath, blackfire, bz2, calendar, Core, ctype, curl, date, dba, dom, ds, enchant, ev, event, exif, fileinfo, filter, ftp, gd, gettext, gmp, gnupg, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml, mailparse, mbstring, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcov, pcre, PDO, pdo_dblib, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, rdkafka, readline, redis, Reflection, session, shmop, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, uuid, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, yaml, Zend OPcache, zip, zlib, Xdebug, Zend OPcache, blackfire + - PHP: apcu, ast, bcmath, blackfire, bz2, calendar, Core, ctype, curl, date, dba, dom, ds, enchant, ev, event, exif, fileinfo, filter, ftp, gd, gettext, gmp, gnupg, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml, mailparse, mbstring, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcov, pcre, PDO, pdo_dblib, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, rdkafka, readline, redis, Reflection, session, shmop, SimpleXML, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, uuid, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, yaml, Zend OPcache, zip, zlib, Xdebug, Zend OPcache, blackfire - Workdir `/srv` - `drupalista/redis` - Based on `redis:5` - Update using unix socket -```yaml -version: '3.6' - -services: - web: - image: drupalista/web - restart: unless-stopped - ports: - - 8000:80 - environment: - - STARTUP_COMMAND_1=composer install - volumes: - - ./:/srv:cached - - ./.data/redis:/tmp/docker:cached - - postgresql: - image: postgres:12 - restart: unless-stopped - ports: - - 5432:5432 - environment: - - POSTGRES_PASSWORD=drupal - - POSTGRES_USER=drupal - - POSTGRES_DB=drupal - volumes: - - ./.data/postgres:/var/lib/postgresql/data - - adminer: - image: dockette/adminer:dg - restart: unless-stopped - ports: - - 8010:80 - - redis: - image: drupalista/redis - restart: unless-stopped - ports: - - 6379:6379 - volumes: - - ./.data/redis:/tmp/docker:cached +```bash +make build +make test +make run ``` -## Development - -See [how to contribute](https://contributte.org/contributing.html) to this package. +The checked-in `docker-compose.yml` exposes the web application on `8000`, Adminer on `8010`, PostgreSQL on `5432` and Redis on `6379`. -This package is currently maintaining by these authors. - - - - - ------ +## Maintenance -Consider to [support](https://github.com/sponsors/f3l1x) **f3l1x**. Also thank you for using this package. +See [how to contribute](https://github.com/dockette/.github/blob/master/CONTRIBUTING.md) to this package. Consider to [support](https://github.com/sponsors/f3l1x) **f3l1x**. Thank you for using this package. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8b3d9c9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,43 @@ +services: + web: + image: drupalista/web:latest + build: + context: . + dockerfile: web/Dockerfile + restart: unless-stopped + ports: + - "8000:80" + environment: + STARTUP_COMMAND_1: composer install + volumes: + - ./:/srv:cached + - ./.data/redis:/tmp/docker:cached + + postgresql: + image: postgres:12 + restart: unless-stopped + ports: + - "5432:5432" + environment: + POSTGRES_PASSWORD: drupal + POSTGRES_USER: drupal + POSTGRES_DB: drupal + volumes: + - ./.data/postgres:/var/lib/postgresql/data + + adminer: + image: dockette/adminer:dg + restart: unless-stopped + ports: + - "8010:80" + + redis: + image: drupalista/redis:latest + build: + context: . + dockerfile: redis/Dockerfile + restart: unless-stopped + ports: + - "6379:6379" + volumes: + - ./.data/redis:/tmp/docker:cached diff --git a/web/Dockerfile b/web/Dockerfile index 0d77a4b..96fe270 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,5 +1,4 @@ ARG PHP_EXTENSIONS="\ - amqp \ apcu \ ast \ bcmath \