From 9f6e8ec60241a9883dc3c39761a8e423a5e806cf Mon Sep 17 00:00:00 2001 From: Yosri Bahri Date: Fri, 5 Apr 2024 16:52:24 +0200 Subject: [PATCH] build SF 6.4 and 7.0 images --- .docker/new-symfony.sh | 12 ++++++++ .github/workflows/build.yaml | 12 +++++--- Dockerfile | 13 ++++---- README.md | 58 ++++++++++++++++++++---------------- 4 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 .docker/new-symfony.sh diff --git a/.docker/new-symfony.sh b/.docker/new-symfony.sh new file mode 100644 index 0000000..f1fc844 --- /dev/null +++ b/.docker/new-symfony.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -eu -o pipefail + +directory="$1" + +# Delete existing symfony project +rm -rf "$directory/symfony" +cd "$directory" + +echo "Installation of symfony project with $SYMFONY_VERSION version" +symfony new symfony --no-git --version="$SYMFONY_VERSION" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 08404d3..203db82 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,13 +18,17 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1'] + php: ['8.1', '8.2'] composer: ['2'] - symfony: ['6.3'] + symfony: ['6.4'] latest: [false] include: + - php: 8.1 + symfony: 7.0 + composer: 2 + latest: false - php: 8.2 - symfony: 6.3 + symfony: 7.0 composer: 2 latest: true name: "[Package] SF v${{ matrix.symfony }} PHP ${{ matrix.php }}" @@ -77,7 +81,7 @@ jobs: matrix: php: ['8.1', '8.2'] composer: ['2'] - symfony: ['6.3'] + symfony: ['6.4', '7.0'] needs: packaging runs-on: ubuntu-latest name: "[Run] SF v${{ matrix.symfony }} PHP ${{ matrix.php }}" diff --git a/Dockerfile b/Dockerfile index b1d9f59..d7af9ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,12 @@ -ARG PHP_VERSION=8 +ARG PHP_VERSION=8.2 ARG COMPOSER_VERSION=2 FROM composer:${COMPOSER_VERSION} as composer FROM php:${PHP_VERSION}-fpm-alpine -ARG PHP_VERSION=8 ENV PHP_VERSION $PHP_VERSION -ARG COMPOSER_VERSION=2 ENV COMPOSER_VERSION $COMPOSER_VERSION -ARG SYMFONY_VERSION=6.2 +ARG SYMFONY_VERSION=6.4 ENV SYMFONY_VERSION $SYMFONY_VERSION COPY --from=composer /usr/bin/composer /usr/bin/composer @@ -23,6 +21,9 @@ RUN apk add --no-cache icu-dev \ COPY .docker/docker-symfony-golden.ini /usr/local/etc/php/conf.d/ ### END SYMFONY REQUIREMENT +COPY ./.docker/new-symfony.sh /usr/local/bin/new-symfony +RUN chmod +x /usr/local/bin/new-symfony + ## SYMFONY CLI INSTALL RUN apk add --no-cache bash git RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.alpine.sh' | bash @@ -33,9 +34,7 @@ RUN apk add symfony-cli HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD symfony check:req || exit 1 # END HEALTHCHECK -WORKDIR /var/www - -RUN symfony new symfony --no-git --version="$SYMFONY_VERSION" +RUN new-symfony "/var/www" WORKDIR /var/www/symfony diff --git a/README.md b/README.md index 84d12c6..cce5a45 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,31 @@ List of docker images available by Symfony and PHP versions: - 7.0 - 8 - Waiting for the version release + 7.0 + 8.2 + + ghcr.io/devgine/symfony-golden:latest
+ ghcr.io/devgine/symfony-golden:v7.0-php8.2-alpine + - 6.4 - 8 - Waiting for the version release + 8.1 + ghcr.io/devgine/symfony-golden:v7.0-php8.1-alpine - 6.3 - 8.3 - Waiting for the version release + 6.4 + 8.2 + + ghcr.io/devgine/symfony-golden:latest
+ ghcr.io/devgine/symfony-golden:v6.4-php8.2-alpine + + 8.1 + ghcr.io/devgine/symfony-golden:v6.4-php8.1-alpine + + + 6.3 8.2 ghcr.io/devgine/symfony-golden:latest
@@ -45,11 +55,7 @@ List of docker images available by Symfony and PHP versions: ghcr.io/devgine/symfony-golden:v6.3-php8.1-alpine - 6.2 - 8.3 - Waiting for the version release - - + 6.2 8.2 ghcr.io/devgine/symfony-golden:v6.2-php8.2-alpine @@ -58,11 +64,7 @@ List of docker images available by Symfony and PHP versions: ghcr.io/devgine/symfony-golden:v6.2-php8.1-alpine - 6.1 - 8.3 - Waiting for the version release - - + 6.1 8.2 ghcr.io/devgine/symfony-golden:v6.1-php8.2-alpine @@ -71,11 +73,7 @@ List of docker images available by Symfony and PHP versions: ghcr.io/devgine/symfony-golden:v6.1-php8.1-alpine - 5.4 - 8.3 - Waiting for the version release - - + 5.4 8.2 ghcr.io/devgine/symfony-golden:v5.4-php8.2-alpine @@ -107,10 +105,11 @@ List of docker images available by Symfony and PHP versions: ```shell docker run --rm -ti -p 8000:8000 -v LOCAL_PROJETC_DIR:/var/www/symfony ghcr.io/devgine/symfony-golden:latest sh ``` -> You can change latest with specific tag
+> You can change latest by a specific tag
> [Available versions](https://github.com/devgine/symfony-golden-image/pkgs/container/symfony-golden/versions) -After the built-in server has been started, visit http://localhost:8000 in your web browser. +After the built-in, server will be started.
+Visit http://localhost:8000 in your web browser. ### Use as base image in Dockerfile ```dockerfile @@ -134,6 +133,13 @@ services: volumes: - '.:/var/www/symfony' ``` +Be careful, if you bind the symfony project as a volume the local directory will erase the symfony project.
+To fix that, after your service running you can launch the below command inside the container. +```bash +new-symfony $DIRECTORY +# example +new-symfony /var/www +``` ## References