Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype of standard make & Docker setup for translations #1534

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM php:8.2-cli

RUN apt-get update && \
apt-get install -y git

WORKDIR /var/www

ADD https://api.github.com/repos/php/phd/git/refs/heads/master version-phd.json
ADD https://api.github.com/repos/php/doc-base/git/refs/heads/master version-doc-base.json
ADD https://api.github.com/repos/php/doc-en/git/refs/heads/master version-doc-en.json

RUN git clone --depth 1 https://github.com/php/phd.git && \
git clone --depth 1 https://github.com/php/doc-base.git && \
git clone --depth 1 https://github.com/php/doc-en.git en

RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini

ENV FORMAT=xhtml
ENV LANG=en

CMD php doc-base/configure.php --disable-segfault-error --with-lang=${LANG} && \
php phd/render.php --docbook doc-base/.manual.xml --output=/var/www/${LANG}/output --package PHP --format ${FORMAT}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
entities.*.xml
/en/
/doc-base/
output
.docker/built
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.PHONY: *

SHELL = /bin/sh

CURRENT_UID := $(shell id -u)
CURRENT_GID := $(shell id -g)

LANG := $(subst doc-,,$(shell basename ${PWD}))

#
# If doc-base, en, or phd exist as siblings to the current directory,
# add those as volumes to our Docker runs.
#

PATHS := -v .:/var/www/${LANG}
ifneq ($(wildcard ../doc-base/LICENSE),)
PATHS += -v ${PWD}/../doc-base:/var/www/doc-base
endif
ifneq ($(wildcard ../phd/LICENSE),)
PATHS += -v ${PWD}/../phd:/var/www/phd
endif
ifneq (${LANG},en)
ifneq ($(wildcard ../en/README.md),)
PATHS += -v ${PWD}/../en:/var/www/en
endif
endif

xhtml: .docker/built
docker run ${PATHS} -w /var/www -u ${CURRENT_UID}:${CURRENT_GID} \
-e LANG=${LANG} php/doc-build

php: .docker/built
docker run ${PATHS} -w /var/www -u ${CURRENT_UID}:${CURRENT_GID} \
-e LANG=${LANG} -e FORMAT=php php/doc-build

build: .docker/built

.docker/built:
docker build .docker -t php/doc-build
touch .docker/built