Skip to content

Commit 2b84d32

Browse files
committed
5402: Update infrastructure for 3.0
1 parent d7e41a6 commit 2b84d32

File tree

16 files changed

+273
-163
lines changed

16 files changed

+273
-163
lines changed

.dockerignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/.git
2+
!/.git/config
3+
4+
# Unneeded application files
5+
/.docker/data/README.md
6+
/.github
7+
/docs
8+
/fixtures
9+
/infrastructure
10+
/public/build
11+
/public/fixtures
12+
public/build
13+
public/fixtures
14+
public/media/*
15+
!public/media/thumbnail_other.png
16+
!public/media/thumbnail_video.png
17+
/scripts
18+
/tests
19+
20+
###> symfony/framework-bundle ###
21+
/.env.local
22+
/.env.local.php
23+
/.env.*.local
24+
/config/secrets/prod/prod.decrypt.private.php
25+
/var/
26+
/vendor/
27+
###< symfony/framework-bundle ###
28+
29+
###> friendsofphp/php-cs-fixer ###
30+
/.php-cs-fixer.php
31+
/.php-cs-fixer.cache
32+
###< friendsofphp/php-cs-fixer ###
33+
34+
###> phpunit/phpunit ###
35+
/phpunit.xml
36+
.phpunit.result.cache
37+
###< phpunit/phpunit ###
38+
39+
###> lexik/jwt-authentication-bundle ###
40+
/config/jwt/*.pem
41+
###< lexik/jwt-authentication-bundle ###
42+
43+
xdebug.ini
44+
launch.json
45+
46+
###> liip/imagine-bundle ###
47+
/public/media/cache/
48+
###< liip/imagine-bundle ###
49+
50+
###> phpstan/phpstan ###
51+
phpstan.neon
52+
###< phpstan/phpstan ###
53+
54+
###> pentatrion/vite-bundle ###
55+
/node_modules/
56+
/public/build/
57+
###< pentatrion/vite-bundle ###
58+
59+
#> Playwright
60+
/test-results/
61+
/playwright-report/
62+
/blob-report/
63+
/playwright/.cache/
64+
#< Playwright
65+
66+
###> vincentlanglet/twig-cs-fixer ###
67+
/.twig-cs-fixer.cache
68+
###< vincentlanglet/twig-cs-fixer ###

.github/Taskfile.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Task file for GitHub Actions, https://taskfile.dev/
2+
3+
version: "3"
4+
5+
# https://taskfile.dev/usage/#env-files
6+
dotenv: [".env.local", ".env"]
7+
8+
tasks:
9+
default:
10+
desc: "List all tasks"
11+
cmds:
12+
- task --list-all
13+
silent: true
14+
15+
build-prod:
16+
desc: "Build application for production"
17+
cmds:
18+
- task setup-network
19+
- task composer-install
20+
- task npm-install
21+
- task install-cleanup
22+
23+
setup-network:
24+
desc: "Setup docker frontend network"
25+
cmds:
26+
- docker network create frontend
27+
28+
composer-install:
29+
desc: "Install dependencies with composer."
30+
cmds:
31+
- docker compose run --rm --env APP_ENV=prod phpfpm composer install --no-dev -o --classmap-authoritative
32+
- docker compose run --rm --env APP_ENV=prod phpfpm composer clear-cache
33+
34+
npm-install:
35+
desc: "Installs node dependencies with npm."
36+
cmds:
37+
- docker compose run --rm node npm install
38+
- docker compose run --rm node npm run build
39+
40+
install-cleanup:
41+
desc: "Cleanup after install"
42+
cmds:
43+
- rm -rf infrastructure
44+
- rm -rf fixtures
45+
- rm -rf tests
46+
- rm -rf node_modules

.github/workflows/docker_build_images_from_develop.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,27 @@ jobs:
1414
APP_VERSION: develop
1515
COMPOSER_ALLOW_SUPERUSER: 1
1616
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v5
19-
2017
- name: Login to DockerHub
2118
uses: docker/login-action@v3
2219
with:
2320
username: ${{ secrets.DOCKERHUB_USER }}
2421
password: ${{ secrets.DOCKERHUB_TOKEN }}
2522

23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
2629
# Build api
2730
- name: Docker meta (API)
2831
id: meta-api
2932
uses: docker/metadata-action@v5
3033
with:
31-
images: os2display/os2display-api-service
34+
images: os2display/display-api-service
3235

3336
- name: Build and push (API)
34-
uses: docker/build-push-action@v5
37+
uses: docker/build-push-action@v6
3538
with:
3639
context: ./infrastructure/display-api-service/
3740
file: ./infrastructure/display-api-service/Dockerfile
@@ -40,16 +43,19 @@ jobs:
4043
push: true
4144
tags: ${{ steps.meta-api.outputs.tags }}
4245
labels: ${{ steps.meta-api.outputs.labels }}
46+
provenance: mode=max
47+
sbom: true
48+
platforms: linux/amd64,linux/arm64
4349

4450
# Build nginx (depends on api build)
4551
- name: Docker meta (Nginx)
4652
id: meta-nginx
4753
uses: docker/metadata-action@v5
4854
with:
49-
images: os2display/os2display-api-service-nginx
55+
images: os2display/display-api-service-nginx
5056

5157
- name: Build and push (Nginx)
52-
uses: docker/build-push-action@v5
58+
uses: docker/build-push-action@v6
5359
with:
5460
context: ./infrastructure/nginx/
5561
file: ./infrastructure/nginx/Dockerfile
@@ -58,3 +64,6 @@ jobs:
5864
push: true
5965
tags: ${{ steps.meta-nginx.outputs.tags }}
6066
labels: ${{ steps.meta-nginx.outputs.labels }}
67+
provenance: mode=max
68+
sbom: true
69+
platforms: linux/amd64,linux/arm64

.github/workflows/docker_build_images_from_tag.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@ name: Build docker image (tag)
1010
jobs:
1111
docker:
1212
runs-on: ubuntu-latest
13-
env:
14-
COMPOSER_ALLOW_SUPERUSER: 1
1513
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v5
18-
1914
- name: Login to DockerHub
2015
uses: docker/login-action@v3
2116
with:
2217
username: ${{ secrets.DOCKERHUB_USER }}
2318
password: ${{ secrets.DOCKERHUB_TOKEN }}
2419

20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
2526
# Build api
2627
- name: Docker meta (API)
2728
id: meta-api
2829
uses: docker/metadata-action@v5
2930
with:
30-
images: os2display/os2display-api-service
31+
images: os2display/display-api-service
3132

3233
- name: Build and push (API)
33-
uses: docker/build-push-action@v5
34+
uses: docker/build-push-action@v6
3435
with:
3536
context: ./infrastructure/display-api-service/
3637
file: ./infrastructure/display-api-service/Dockerfile
@@ -39,13 +40,15 @@ jobs:
3940
push: true
4041
tags: ${{ steps.meta-api.outputs.tags }}
4142
labels: ${{ steps.meta-api.outputs.labels }}
43+
provenance: mode=max
44+
sbom: true
4245

4346
# Build nginx (depends on api build)
4447
- name: Docker meta (Nginx)
4548
id: meta-nginx
4649
uses: docker/metadata-action@v5
4750
with:
48-
images: os2display/os2display-api-service-nginx
51+
images: os2display/display-api-service-nginx
4952

5053
- name: Get the tag
5154
id: get_tag
@@ -61,3 +64,5 @@ jobs:
6164
push: true
6265
tags: ${{ steps.meta-nginx.outputs.tags }}
6366
labels: ${{ steps.meta-nginx.outputs.labels }}
67+
provenance: mode=max
68+
sbom: true

.github/workflows/github_build_release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ name: Create Github Release
88
permissions:
99
contents: write
1010

11+
env:
12+
COMPOSE_USER: runner
13+
1114
jobs:
1215
create-release:
1316
runs-on: ubuntu-latest
14-
env:
15-
COMPOSER_ALLOW_SUPERUSER: 1
16-
APP_ENV: prod
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Composer install
22-
run: |
23-
docker network create frontend
24-
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer install --no-dev -o --classmap-authoritative
25-
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer clear-cache
26-
rm -rf infrastructure
21+
- name: Install Task task runner
22+
uses: go-task/setup-task@v1
2723

24+
- name: Install, Build, Cleanup
25+
run: |
26+
task --taskfile=.github/Taskfile.yaml build-prod
27+
2828
- name: Make assets dir
2929
run: |
3030
mkdir -p ../assets
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: Create a release in GitHub and uploads assets
4141
run: |
42-
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
42+
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ${{ steps.prerelease.outputs.flag }} ../assets/*.*
4343
env:
4444
GITHUB_TOKEN: ${{ github.TOKEN }}
4545
shell: bash

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
/.php-cs-fixer.cache
2626
###< friendsofphp/php-cs-fixer ###
2727

28-
node_modules
29-
3028
public/media/*
3129
!public/media/thumbnail_video.png
3230
!public/media/thumbnail_other.png

docker-compose.server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ networks:
88

99
services:
1010
phpfpm:
11-
image: itkdev/php8.3-fpm:alpine
11+
image: itkdev/php8.4-fpm:alpine
1212
restart: unless-stopped
1313
networks:
1414
- app

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
#- ENCRYPT=1 # Uncomment to enable database encryption.
2828

2929
phpfpm:
30-
image: itkdev/php8.3-fpm:latest
30+
image: itkdev/php8.4-fpm:latest
3131
user: ${COMPOSE_USER:-deploy}
3232
networks:
3333
- app

infrastructure/build-n-push.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
APP_VERSION=develop
6+
7+
docker pull itkdev/php8.4-fpm:alpine
8+
docker pull nginxinc/nginx-unprivileged:alpine
9+
10+
docker build --build-context repository-root=.. \
11+
--platform linux/amd64,linux/arm64 \
12+
--pull \
13+
--no-cache \
14+
--build-arg APP_VERSION=${APP_VERSION} \
15+
--tag=turegjorup/display-api-service:${APP_VERSION} \
16+
--file="display-api-service/Dockerfile" display-api-service
17+
18+
19+
docker build --build-context repository-root=.. \
20+
--platform linux/amd64,linux/arm64 \
21+
--no-cache \
22+
--build-arg VERSION=${APP_VERSION} \
23+
--tag=turegjorup/display-api-service-nginx:${APP_VERSION} \
24+
--file="nginx/Dockerfile" nginx
25+
26+
docker push os2display/display-api-service:${APP_VERSION}
27+
docker push os2display/display-api-service-nginx:${APP_VERSION}

0 commit comments

Comments
 (0)