Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yoanbernabeu committed Dec 20, 2024
1 parent f414f11 commit e26a93f
Show file tree
Hide file tree
Showing 82 changed files with 13,032 additions and 1,257 deletions.
65 changes: 65 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
/assets/vendor/
###< symfony/framework-bundle ###

###> development files ###
.git
.gitignore
.github
docker-compose*.yml
compose.yaml
Dockerfile*
.dockerignore
.env.test
phpunit.xml.dist
README.md
CHANGELOG.md
LICENSE
###< development files ###

###> IDE files ###
.idea/
.vscode/
*.sublime-workspace
*.sublime-project
###< IDE files ###

###> testing ###
/tests/
/phpunit.xml
.phpunit.result.cache
/coverage/
###< testing ###

###> node ###
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
###< node ###

###> misc ###
*.log
*.cache
.DS_Store
Thumbs.db
###< misc ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
23 changes: 22 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,26 @@

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
APP_SECRET=3ab646fbee5901930d1a63635406e1b9e2a014b405710f5bf3ca459e6da7d8e0
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
#DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
45 changes: 45 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Push Docker Image

on:
push:
branches:
- "main"
tags:
- "*.*.*"
pull_request:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set Docker tags
id: meta
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
echo "tags=yoanbernabeu/openstreampoll:${VERSION},yoanbernabeu/openstreampoll:latest" >> $GITHUB_OUTPUT
else
echo "tags=yoanbernabeu/openstreampoll:dev" >> $GITHUB_OUTPUT
fi
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
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

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
48 changes: 48 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Quality Assurance

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
static-code-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: PHP CS Fixer
uses: docker://jakzal/phpqa:php8.3
with:
args: php-cs-fixer fix ./src --rules=@Symfony --verbose --dry-run

- name: PHPStan
uses: docker://jakzal/phpqa:php8.3
with:
args: phpstan analyse ./src --level=8

- name: Security Check
uses: docker://jakzal/phpqa:php8.3
with:
args: local-php-security-checker

- name: Lint Twig
uses: docker://jakzal/phpqa:php8.3
with:
args: bin/console lint:twig ./templates

- name: Lint YAML
uses: docker://jakzal/phpqa:php8.3
with:
args: bin/console lint:yaml ./config

- name: Lint Container
uses: docker://jakzal/phpqa:php8.3
with:
args: bin/console lint:container

- name: Run Tests
uses: docker://jakzal/phpqa:php8.3
with:
args: bin/phpunit --testdox
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
Expand All @@ -7,4 +6,23 @@
/public/bundles/
/var/
/vendor/
/node_modules/
###< symfony/framework-bundle ###

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

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/asset-mapper ###
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###
.php-cs-fixer.cache
compose.prod.yaml
*.bak
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# install PHP dependencies for development
FROM composer:2 AS composer_dev
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-scripts --no-progress --prefer-dist

# install PHP dependencies for production
FROM composer:2 AS composer_prod
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-scripts --no-progress --prefer-dist --no-dev

# install Node dependencies
FROM node:20 AS node
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install

# build assets
FROM dunglas/frankenphp AS build
WORKDIR /app
COPY --from=composer_dev /app/vendor /app/vendor
COPY --from=node /app/node_modules /app/node_modules
COPY . /app/
RUN APP_ENV=prod php bin/console tailwind:build --minify
RUN APP_ENV=prod php bin/console importmap:install
RUN APP_ENV=prod php bin/console asset-map:compile

# build the final image
FROM dunglas/frankenphp

ENV SERVER_NAME=your-app.com
ENV APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime
ENV APP_ENV=prod
ENV FRANKENPHP_CONFIG="worker ./public/index.php"

COPY . /app/
COPY --from=composer_prod /app/vendor /app/vendor
COPY --from=node /app/node_modules /app/node_modules
COPY --from=build /app/public/assets /app/public/assets
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Yoan Bernabeu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit e26a93f

Please sign in to comment.