Skip to content

Commit

Permalink
Merge pull request #7822 from tenkoma/2.x-update-dockerfile-and-build
Browse files Browse the repository at this point in the history
2.x fix build and deploy
  • Loading branch information
markstory authored Mar 17, 2024
2 parents c1d6ebc + a8dd75a commit 307ee30
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 104 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ on:
branches:
- '*'

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
doc-type: ['HTML', 'EPUB', 'PDF']

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: 3.11

- name: Install dependencies
run: |
Expand All @@ -33,6 +32,7 @@ jobs:
- name: Install packages
run: |
sudo apt update
sudo apt install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-all
- name: Build Docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_2x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
FROM debian:bullseye
FROM debian:bookworm

ENV DEBIAN_FRONTEND noninteractive

LABEL Description="This image is used to create an environment to contribute to the cakephp/docs"

RUN apt-get update && apt-get install -y \
python3-pip \
texlive-latex-recommended \
texlive-latex-extra \
build-essential \
latexmk \
php \
python3-full \
texlive-fonts-recommended \
texlive-lang-all \
latexmk \
texlive-latex-extra \
texlive-latex-recommended \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN python3 -m venv /tmp/venv
ENV PATH="/tmp/venv/bin:$PATH"

COPY requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

WORKDIR /data
VOLUME "/data"

CMD ["/bin/bash"]
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Inspired by the Makefile used by bazaar.
# https://bazaar.launchpad.net/~bzr-pqm/bzr/2.3/

PYTHON = python
PYTHON = python3
ES_HOST =
ES_HOST_V2 =

Expand All @@ -16,6 +16,9 @@ PDF_LANGS = en es fr pt

DEST = website

EPUB_ARGS =
SPHINXOPTS =

# Get path to theme directory to build static assets.
THEME_DIR = $(shell python3 -c 'import os, cakephpsphinx; print(os.path.abspath(os.path.dirname(cakephpsphinx.__file__)))')

Expand All @@ -30,13 +33,13 @@ epub: $(foreach lang, $(LANGS), epub-$(lang))
latex: $(foreach lang, $(PDF_LANGS), latex-$(lang))
pdf: $(foreach lang, $(PDF_LANGS), pdf-$(lang))
htmlhelp: $(foreach lang, $(LANGS), htmlhelp-$(lang))
populate-index: $(foreach lang, $(LANGS), populate-index-$(lang))
server: $(foreach lang, $(LANGS), server-$(lang))
rebuild-index: $(foreach lang, $(LANGS), rebuild-index-$(lang))


# Make the HTML version of the documentation with correctly nested language folders.
html-%:
cd $* && make html
cd $* && make html SPHINXOPTS="$(SPHINXOPTS)"
make build/html/$*/_static/css/dist.css
make build/html/$*/_static/js/dist.js

Expand All @@ -52,12 +55,11 @@ latex-%:
pdf-%:
cd $* && make latexpdf

populate-index-%:
php scripts/populate_search_index.php --lang="$*" --host="$(ES_HOST_V2)"
server-%:
cd build/html/$* && python3 -m SimpleHTTPServer

rebuild-index-%:
curl -XDELETE $(ES_HOST)/documentation/2-2-$*
php scripts/populate_search_index.php $* $(ES_HOST)
epub-check-%: build/epub/$*
java -jar /epubcheck/epubcheck.jar build/epub/$*/CakePHP.epub $(EPUB_ARGS)

website-dirs:
# Make the directory if its not there already.
Expand Down
25 changes: 12 additions & 13 deletions en/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = en
SPHINX_LANG = en

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -40,9 +39,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -65,10 +64,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -89,22 +88,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
25 changes: 12 additions & 13 deletions es/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = es
SPHINX_LANG = es

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
25 changes: 12 additions & 13 deletions fr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = fr
SPHINX_LANG = fr

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$(SPHINX_LANG) -c $(CONFDIR) -D language=$(SPHINX_LANG) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

Expand All @@ -41,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(LANG)
$(SPHINXBUILD) -b html -D "exclude_patterns=*-contents.rst" $(ALLSPHINXOPTS) $(BUILDDIR)/html/$(SPHINX_LANG)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(LANG)."
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/$(SPHINX_LANG)."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
Expand All @@ -66,10 +65,10 @@ json:
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(LANG)
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/$(LANG)."
".hhp project file in $(BUILDDIR)/htmlhelp/$(SPHINX_LANG)."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
Expand All @@ -90,22 +89,22 @@ devhelp:
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(LANG)
$(SPHINXBUILD) -b epub -D master_doc='epub-contents' $(ALLSPHINXOPTS) $(BUILDDIR)/epub/$(SPHINX_LANG)
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(LANG)."
@echo "Build finished. The epub file is in $(BUILDDIR)/epub/$(SPHINX_LANG)."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(LANG)."
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(LANG)
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex/$(SPHINX_LANG)
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex/$(LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(LANG)."
make -C $(BUILDDIR)/latex/$(SPHINX_LANG) all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex/$(SPHINX_LANG)."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
Loading

0 comments on commit 307ee30

Please sign in to comment.