Verified Commit 14089f05 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat(docker): replace all-in-one image with FrankenPHP and Caddy based image + discard other images

- use serversideup/php as a base image
- remove nginx unit base
- remove app / webserver images
- add bundle stage to remove pipeline dependency
- update docker setup docs
- edit gitlabci rules and release logic
parent 07247bf0
Loading
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+68 −0
Original line number Diff line number Diff line
.env

.git/
node_modules/
vendor/
build/
docs/
scripts/
tests/

#-------------------------
# Temporary Files
#-------------------------
writable/cache/*
!writable/cache/index.html

writable/logs/*
!writable/logs/index.html

writable/session/*
!writable/session/index.html

writable/temp/*
!writable/temp/index.html

writable/uploads/*
!writable/uploads/index.html

writable/debugbar/*
!writable/debugbar/index.html

# public folder
public/*
!public/media
!public/.htaccess
!public/favicon.ico
!public/icon*
!public/castopod-banner*
!public/castopod-avatar*
!public/index.php
!public/robots.txt
!public/.well-known
!public/.well-known/GDPR.yml

public/assets/*
!public/assets/index.html

# public media folder
!public/media/podcasts
!public/media/persons
!public/media/site

public/media/podcasts/*
!public/media/podcasts/index.html

public/media/persons/*
!public/media/persons/index.html

public/media/site/*
!public/media/site/index.html

# Generated files
modules/Admin/Language/*/PersonsTaxonomy.php

# Castopod bundle & packages
castopod/
castopod-*.zip
castopod-*.tar.gz
+0 −9
Original line number Diff line number Diff line
@@ -175,15 +175,6 @@ public/media/site/*
# Generated files
modules/Admin/Language/*/PersonsTaxonomy.php

#-------------------------
# Docker volumes
#-------------------------

mariadb
phpmyadmin
sessions
data

# Castopod bundle & packages
castopod/
castopod-*.zip
+49 −31
Original line number Diff line number Diff line
@@ -23,6 +23,10 @@ php-dependencies:
    expire_in: 30 mins
    paths:
      - vendor/
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

js-dependencies:
  stage: prepare
@@ -39,6 +43,10 @@ js-dependencies:
    expire_in: 30 mins
    paths:
      - node_modules/
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

lint-commit-msg:
  stage: quality
@@ -48,11 +56,10 @@ lint-commit-msg:
    - ./scripts/lint-commit-msg.sh
  dependencies:
    - js-dependencies
  only:
    - develop
    - main
    - beta
    - alpha
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^(develop|main|alpha|beta|next)$/

lint-php:
  stage: quality
@@ -65,6 +72,10 @@ lint-php:
    - vendor/bin/rector process --dry-run --ansi
  dependencies:
    - php-dependencies
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

lint-js:
  stage: quality
@@ -74,6 +85,10 @@ lint-js:
    - pnpm run lint
  dependencies:
    - js-dependencies
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

tests:
  stage: quality
@@ -92,6 +107,10 @@ tests:
    - vendor/bin/phpunit --no-coverage
  dependencies:
    - php-dependencies
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

bundle:
  stage: bundle
@@ -112,13 +131,12 @@ bundle:
    name: "castopod-${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
    paths:
      - castopod
  only:
    variables:
      - $CI_PROJECT_NAMESPACE == "adaures"
  except:
    - main
    - beta
    - alpha
  rules:
    - if: $CI_PROJECT_NAMESPACE != "adaures"
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^(main|beta|alpha|next)$/ || $CI_COMMIT_TAG
      when: never
    - when: on_success

release:
  stage: release
@@ -142,38 +160,38 @@ release:
  artifacts:
    paths:
      - castopod
      - CP_VERSION.env
  only:
    - main
    - beta
    - alpha
  rules:
    - if: $CI_PROJECT_NAMESPACE != "adaures"
      when: never
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^(main|alpha|beta|next)$/

website:
  stage: deploy
  trigger: adaures/castopod.org
  only:
    - main
    - beta
    - alpha
  rules:
    - if: $CI_PROJECT_NAMESPACE != "adaures"
      when: never
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/ && $CI_COMMIT_TAG

documentation:
  stage: deploy
  trigger:
    include: docs/.gitlab-ci.yml
    strategy: depend
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - when: on_success

docker:
  stage: build
  trigger:
    include: docker/production/.gitlab-ci.yml
    strategy: depend
  variables:
    PARENT_PIPELINE_ID: $CI_PIPELINE_ID
  only:
    refs:
      - develop
      - main
      - beta
      - alpha
    variables:
      - $CI_PROJECT_NAMESPACE == "adaures"
  rules:
    - if: $CI_PROJECT_NAMESPACE != "adaures"
      when: never
    - if: $CI_COMMIT_BRANCH == "develop"
    - if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/ && $CI_COMMIT_TAG
+2 −1
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@
          "package.json",
          "package-lock.json",
          "CHANGELOG.md"
        ]
        ],
        "message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
      }
    ],
    [
+106 −70
Original line number Diff line number Diff line
@@ -30,7 +30,8 @@ if (! function_exists('get_podcast_metatags')) {
        $category .= $podcast->category->apple_category;

        $schema = new Schema(
            new Thing('PodcastSeries', [
            new Thing(
                props: [
                    'name'        => $podcast->title,
                    'headline'    => $podcast->title,
                    'url'         => current_url(),
@@ -45,7 +46,9 @@ if (! function_exists('get_podcast_metatags')) {
                    'publisher'   => $podcast->publisher,
                    'inLanguage'  => $podcast->language_code,
                    'genre'       => $category,
            ])
                ],
                type: 'PodcastSeries'
            )
        );

        $metatags = new MetaTags();
@@ -79,7 +82,8 @@ if (! function_exists('get_episode_metatags')) {
    function get_episode_metatags(Episode $episode): string
    {
        $schema = new Schema(
            new Thing('PodcastEpisode', [
            new Thing(
                props: [
                    'url'             => url_to('episode', esc($episode->podcast->handle), $episode->slug),
                    'name'            => $episode->title,
                    'image'           => $episode->cover->feed_url,
@@ -87,14 +91,22 @@ if (! function_exists('get_episode_metatags')) {
                    'datePublished'   => $episode->published_at->format(DATE_ISO8601),
                    'timeRequired'    => iso8601_duration($episode->audio->duration),
                    'duration'        => iso8601_duration($episode->audio->duration),
                'associatedMedia' => new Thing('MediaObject', [
                    'associatedMedia' => new Thing(
                        props: [
                            'contentUrl' => $episode->audio_url,
                ]),
                'partOfSeries' => new Thing('PodcastSeries', [
                        ],
                        type: 'MediaObject'
                    ),
                    'partOfSeries' => new Thing(
                        props: [
                            'name' => $episode->podcast->title,
                            'url'  => $episode->podcast->link,
                ]),
            ])
                        ],
                        type: 'PodcastSeries'
                    ),
                ],
                type: 'PodcastEpisode'
            )
        );

        $metatags = new MetaTags();
@@ -140,32 +152,50 @@ if (! function_exists('get_episode_metatags')) {
if (! function_exists('get_post_metatags')) {
    function get_post_metatags(Post $post): string
    {
        $socialMediaPosting = new Thing('SocialMediaPosting', [
        $socialMediaPosting = new Thing(
            props: [
                '@id'           => url_to('post', esc($post->actor->username), $post->id),
                'datePublished' => $post->published_at->format(DATE_ISO8601),
            'author'        => new Thing('Person', [
                'author'        => new Thing(
                    props: [
                        'name' => $post->actor->display_name,
                        'url'  => $post->actor->uri,
            ]),
                    ],
                    type: 'Person'
                ),
                'text' => $post->message,
        ]);
            ],
            type: 'SocialMediaPosting'
        );

        if ($post->episode_id !== null) {
            $socialMediaPosting->__set('sharedContent', new Thing('Audio', [
            $socialMediaPosting->__set('sharedContent', new Thing(
                props: [
                    'headline' => $post->episode->title,
                    'url'      => $post->episode->link,
                'author'   => new Thing('Person', [
                    'author'   => new Thing(
                        props: [
                            'name' => $post->episode->podcast->owner_name,
                ]),
            ]));
                        ],
                        type: 'Person'
                    ),
                ],
                type: 'Audio'
            ));
        } elseif ($post->preview_card instanceof PreviewCard) {
            $socialMediaPosting->__set('sharedContent', new Thing('WebPage', [
            $socialMediaPosting->__set('sharedContent', new Thing(
                props: [
                    'headline' => $post->preview_card->title,
                    'url'      => $post->preview_card->url,
                'author'   => new Thing('Person', [
                    'author'   => new Thing(
                        props: [
                            'name' => $post->preview_card->author_name,
                ]),
            ]));
                        ],
                        type: 'Person'
                    ),
                ],
                type: 'WebPage'
            ));
        }

        $schema = new Schema($socialMediaPosting);
@@ -192,7 +222,8 @@ if (! function_exists('get_post_metatags')) {
if (! function_exists('get_episode_comment_metatags')) {
    function get_episode_comment_metatags(EpisodeComment $episodeComment): string
    {
        $schema = new Schema(new Thing('SocialMediaPosting', [
        $schema = new Schema(new Thing(
            props: [
                '@id' => url_to(
                    'episode-comment',
                    esc($episodeComment->actor->username),
@@ -200,13 +231,18 @@ if (! function_exists('get_episode_comment_metatags')) {
                    $episodeComment->id
                ),
                'datePublished' => $episodeComment->created_at->format(DATE_ISO8601),
            'author'        => new Thing('Person', [
                'author'        => new Thing(
                    props: [
                        'name' => $episodeComment->actor->display_name,
                        'url'  => $episodeComment->actor->uri,
            ]),
                    ],
                    type: 'Person'
                ),
                'text'        => $episodeComment->message,
                'upvoteCount' => $episodeComment->likes_count,
        ]));
            ],
            type: 'SocialMediaPosting'
        ));

        $metatags = new MetaTags();
        $metatags
Loading