File tree Expand file tree Collapse file tree 6 files changed +80
-24
lines changed Expand file tree Collapse file tree 6 files changed +80
-24
lines changed Original file line number Diff line number Diff line change 1919 php-version : ${{ matrix.php }}
2020 coverage : none
2121 - run : make
22- - run : make served
22+ - run : docker compose build
23+ - run : docker compose up -d
2324 - run : bash tests/await.bash http://clue.localhost/
2425 - run : make test
26+ - run : docker compose stop -t 60
27+ timeout-minutes : 0.5
28+ - run : docker compose logs
29+ if : ${{ always() }}
2530 -
run :
git config --global user.name "GitHub Actions" && git config --global user.email "[email protected] " 2631 - run : git config --global url."https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
2732 - run : make deploy
Original file line number Diff line number Diff line change 11/vendor /
22/build /
3- /tailwindcss
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1
2+ FROM composer:2 AS composer
3+ WORKDIR /app/
4+ COPY composer.json composer.lock ./
5+ RUN composer install --ignore-platform-reqs --optimize-autoloader
6+
7+ FROM scratch AS tailwind
8+ WORKDIR /app/
9+ ADD --checksum=sha256:cd52e757cb0bd15238f0207a215198d924811234028d056b7be39fde70491296 --chmod=0755 \
10+ https://github.com/tailwindlabs/tailwindcss/releases/download/v3.2.4/tailwindcss-linux-x64 /usr/local/bin/tailwindcss
11+ ENTRYPOINT ["tailwindcss" ]
12+
13+ FROM php:8.1-apache AS build
14+ WORKDIR /app/
15+ COPY --from=composer /app/vendor/ vendor/
16+ COPY app/ app/
17+ COPY www/ www/
18+ RUN vendor/bin/sculpin generate
19+
20+ FROM php:8.1-apache
21+ RUN ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled
22+ COPY --from=build /app/build/ /var/www/html/
Original file line number Diff line number Diff line change @@ -5,21 +5,10 @@ vendor: composer.json composer.lock
55 composer install
66 touch $@
77
8- www/src/tailwind.min.css : www/_layouts/* www/_posts/* www/_talks/* www/* .html www/* .html.twig tailwindcss tailwind.config.js
9- ./tailwindcss -o $@ --minify
8+ www/src/tailwind.min.css : www/_layouts/* www/_posts/* www/_talks/* www/* .html www/* .html.twig tailwind.config.js
9+ docker compose run --rm --build tailwind -o $@ --minify
1010 touch $@
1111
12- tailwindcss :
13- test -x tailwindcss || curl -L https://github.com/tailwindlabs/tailwindcss/releases/download/v3.2.4/tailwindcss-linux-x64 > tailwindcss && chmod +x tailwindcss
14-
15- serve : build
16- docker run -it --rm -p 80:80 -v " $$ PWD" /build/:/var/www/html/ php:8.1-apache sh -c " ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled; apache2-foreground"
17-
18- served : build
19- docker run -d --rm -p 80:80 -v " $$ PWD" /build/:/var/www/html/ php:8.1-apache sh -c " ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled; apache2-foreground"
20- @sleep 2
21- @echo Container running. Use \" docker rm -f {containerId}\" to stop container.
22-
2312test :
2413 bash tests/integration.bash http://clue.localhost/
2514 test -z " $$ (git status --porcelain)" || (echo Directory is dirty && git status && exit 1)
@@ -33,6 +22,7 @@ deploy:
3322 git -C build/ push origin live -f
3423
3524clean :
36- rm -rf build/ vendor/ tailwindcss
25+ rm -rf build/ vendor/
26+ docker compose down --remove-orphans --rmi local
3727
38- .PHONY : build serve served test deploy clean
28+ .PHONY : build test deploy clean
Original file line number Diff line number Diff line change 55
66Source code for the https://clue.engineering/ website.
77
8- ## Build
8+ ## Development
9+
10+ ### Build
911
1012You can build the website like this:
1113
1214``` bash
1315make
1416```
1517
18+ ### Run
19+
1620Once built, you can manually browse the ` build/ ` directory or run the web server
1721container (Apache) in the foreground like this:
1822
1923``` bash
20- make serve
24+ docker compose up --build --watch
2125```
2226
23- Alternatively, you may also run the web server container (Apache) as a
24- background daemon like this:
27+ > Once running, you can now access http://clue.localhost/ in your web browser.
28+ > If you want to run this on a different port, you may pass the ` PORT `
29+ > environment variable like ` PORT=8080 docker compose up ` .
30+ > To run the container in the background, you may use the ` docker compose up -d ` command.
2531
26- ``` bash
27- make served
28- ```
32+ ### Tests
2933
3034Once running, you can run some integration tests that check correct paths etc.
3135like this:
@@ -41,6 +45,8 @@ make test
4145> tests/integration.bash http://clue.localhost/
4246> ` ` `
4347
48+ # ## Cleanup
49+
4450Once done, you can clean up like this:
4551
4652` ` ` bash
Original file line number Diff line number Diff line change 1+ services :
2+ # main apache service running the full website
3+ apache :
4+ build : .
5+ ports :
6+ - ${PORT:-80}:80
7+ restart : unless-stopped
8+ develop :
9+ watch :
10+ - path : app/
11+ action : rebuild
12+ - path : www/
13+ action : rebuild
14+ - path : composer.lock
15+ action : rebuild
16+ - path : Dockerfile
17+ action : rebuild
18+
19+ # tailwind dev sidecar to watch and recompile CSS on demand
20+ tailwind :
21+ build :
22+ context : .
23+ target : tailwind
24+ command : --watch -o www/src/tailwind.min.css --minify
25+ restart : unless-stopped
26+ stdin_open : true
27+ stop_signal : SIGKILL
28+ volumes :
29+ - ./tailwind.config.js:/app/tailwind.config.js:ro
30+ - ./www:/app/www:rw
31+ develop :
32+ watch :
33+ - path : Dockerfile
34+ action : rebuild
You can’t perform that action at this time.
0 commit comments