Skip to content
Open
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
57 changes: 57 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/.git
!/.git/config

# Unneeded application files
/.docker/data/README.md
/.github
/docs
/fixtures
/infrastructure
/public/build
/public/fixtures
/public/media/*
!public/media/thumbnail_other.png
!public/media/thumbnail_video.png
/scripts
/tests

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/var/
/vendor/
###< symfony/framework-bundle ###

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###

xdebug.ini
launch.json

###> pentatrion/vite-bundle ###
/node_modules/
###< pentatrion/vite-bundle ###

#> Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
#< Playwright

###> vincentlanglet/twig-cs-fixer ###
/.twig-cs-fixer.cache
###< vincentlanglet/twig-cs-fixer ###
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ITKDEV_TEMPLATE=symfony-6

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=22d8a60c047b96413b3337e3ddae3da9
APP_SECRET=CHANGE_ME
TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR
###< symfony/framework-bundle ###

Expand All @@ -42,7 +42,7 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=APP_JWT_PASSPHRASE
JWT_PASSPHRASE=CHANGE_ME
# Default: 1 hour
JWT_TOKEN_TTL=3600
# Default: 15 days
Expand Down
46 changes: 46 additions & 0 deletions .github/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Task file for GitHub Actions, https://taskfile.dev/

version: "3"

# https://taskfile.dev/usage/#env-files
dotenv: [".env.local", ".env"]

tasks:
default:
desc: "List all tasks"
cmds:
- task --list-all
silent: true

build-prod:
desc: "Build application for production"
cmds:
- task setup-network
- task composer-install
- task npm-install
- task install-cleanup

setup-network:
desc: "Setup docker frontend network"
cmds:
- docker network create frontend

composer-install:
desc: "Install dependencies with composer."
cmds:
- docker compose run --rm --env APP_ENV=prod phpfpm composer install --no-dev -o --classmap-authoritative
- docker compose run --rm --env APP_ENV=prod phpfpm composer clear-cache

npm-install:
desc: "Installs node dependencies with npm."
cmds:
- docker compose run --rm node npm install
- docker compose run --rm node npm run build

install-cleanup:
desc: "Cleanup after install"
cmds:
- rm -rf infrastructure
- rm -rf fixtures
- rm -rf tests
- rm -rf node_modules
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
branches:
- "develop"

# This Action builds to os2display/* using ./infrastructure/os2display/*
name: OS2display - Build docker image (develop)
# This Action builds to os2display/* using ./infrastructure/*
name: Build docker image (develop)

jobs:
docker:
Expand All @@ -14,15 +14,18 @@ jobs:
APP_VERSION: develop
COMPOSER_ALLOW_SUPERUSER: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Build api
- name: Docker meta (API)
id: meta-api
Expand All @@ -31,15 +34,18 @@ jobs:
images: os2display/display-api-service

- name: Build and push (API)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ./infrastructure/os2display/display-api-service/
file: ./infrastructure/os2display/display-api-service/Dockerfile
context: ./infrastructure/display-api-service/
file: ./infrastructure/display-api-service/Dockerfile
build-args: |
VERSION=${{ env.APP_VERSION }}
push: true
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
provenance: mode=max
sbom: true
platforms: linux/amd64,linux/arm64

# Build nginx (depends on api build)
- name: Docker meta (Nginx)
Expand All @@ -49,12 +55,15 @@ jobs:
images: os2display/display-api-service-nginx

- name: Build and push (Nginx)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ./infrastructure/os2display/nginx/
file: ./infrastructure/os2display/nginx/Dockerfile
context: ./infrastructure/nginx/
file: ./infrastructure/nginx/Dockerfile
build-args: |
APP_VERSION=${{ env.APP_VERSION }}
push: true
tags: ${{ steps.meta-nginx.outputs.tags }}
labels: ${{ steps.meta-nginx.outputs.labels }}
provenance: mode=max
sbom: true
platforms: linux/amd64,linux/arm64
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ on:
tags:
- "*"

# This Action builds to os2display/* using ./infrastructure/os2display/*
name: OS2display - Build docker image (tag)
# This Action builds to os2display/* using ./infrastructure/*
name: Build docker image (tag)

jobs:
docker:
runs-on: ubuntu-latest
env:
COMPOSER_ALLOW_SUPERUSER: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Build api
- name: Docker meta (API)
id: meta-api
Expand All @@ -30,15 +31,17 @@ jobs:
images: os2display/display-api-service

- name: Build and push (API)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ./infrastructure/os2display/display-api-service/
file: ./infrastructure/os2display/display-api-service/Dockerfile
context: ./infrastructure/display-api-service/
file: ./infrastructure/display-api-service/Dockerfile
build-args: |
APP_VERSION=${{ github.ref }}
push: true
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
provenance: mode=max
sbom: true

# Build nginx (depends on api build)
- name: Docker meta (Nginx)
Expand All @@ -54,10 +57,12 @@ jobs:
- name: Build and push (Nginx)
uses: docker/build-push-action@v5
with:
context: ./infrastructure/os2display/nginx/
file: ./infrastructure/os2display/nginx/Dockerfile
context: ./infrastructure/nginx/
file: ./infrastructure/nginx/Dockerfile
build-args: |
APP_VERSION=${{ steps.get_tag.outputs.git_tag }}
push: true
tags: ${{ steps.meta-nginx.outputs.tags }}
labels: ${{ steps.meta-nginx.outputs.labels }}
provenance: mode=max
sbom: true
20 changes: 10 additions & 10 deletions .github/workflows/github_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ name: Create Github Release
permissions:
contents: write

env:
COMPOSE_USER: runner

jobs:
create-release:
runs-on: ubuntu-latest
env:
COMPOSER_ALLOW_SUPERUSER: 1
APP_ENV: prod
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install, Build, Cleanup
run: |
task --taskfile=.github/Taskfile.yaml build-prod

- name: Make assets dir
run: |
mkdir -p ../assets
Expand All @@ -39,7 +39,7 @@ jobs:

- name: Create a release in GitHub and uploads assets
run: |
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ${{ steps.prerelease.outputs.flag }} ../assets/*.*
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
shell: bash
60 changes: 0 additions & 60 deletions .github/workflows/itkdev_docker_build_develop.yml

This file was deleted.

Loading