From 9a5749d77169fb57785f7584c53e27cb71ebc251 Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Fri, 22 Nov 2024 16:11:49 +0100 Subject: [PATCH 1/4] Add docker cli image --- ...age.yml => build-and-publish-ci-image.yml} | 4 +- .../build-and-publish-franken-image.yml | 50 +++++++++++++++++++ docker/franken-image/Dockerfile | 38 ++++++++++++++ docker/franken-image/logo-ascii | 30 +++++++++++ 4 files changed, 120 insertions(+), 2 deletions(-) rename .github/workflows/{build-and-publish-image.yml => build-and-publish-ci-image.yml} (93%) create mode 100644 .github/workflows/build-and-publish-franken-image.yml create mode 100644 docker/franken-image/Dockerfile create mode 100644 docker/franken-image/logo-ascii diff --git a/.github/workflows/build-and-publish-image.yml b/.github/workflows/build-and-publish-ci-image.yml similarity index 93% rename from .github/workflows/build-and-publish-image.yml rename to .github/workflows/build-and-publish-ci-image.yml index 2be5c90..808712b 100644 --- a/.github/workflows/build-and-publish-image.yml +++ b/.github/workflows/build-and-publish-ci-image.yml @@ -1,4 +1,4 @@ -name: Build Docker image +name: Build Docker CI image on: push: @@ -14,7 +14,7 @@ env: jobs: build-and-push-image: - name: Push Docker image to Docker Hub + name: Push Docker ci image to Docker Hub runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/build-and-publish-franken-image.yml b/.github/workflows/build-and-publish-franken-image.yml new file mode 100644 index 0000000..76f6c4e --- /dev/null +++ b/.github/workflows/build-and-publish-franken-image.yml @@ -0,0 +1,50 @@ +name: Build Docker franken image + +on: + push: + branches: + - "main" + tags: + - '*' + paths: + - .gitattributes + - .github/workflows/build-and-publish-franken-image.yml + - docker/franken-image/Dockerfile + - composer.* + - src/** + +env: + IMAGE_NAME: db-tools-bundle + +jobs: + build-and-push-image: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: simonmellerin/db-tools-bundle + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: docker/franken-image/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags == 'main' && 'latest' || steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/franken-image/Dockerfile b/docker/franken-image/Dockerfile new file mode 100644 index 0000000..8eff257 --- /dev/null +++ b/docker/franken-image/Dockerfile @@ -0,0 +1,38 @@ +FROM dunglas/frankenphp:1-php8.3 +ARG TAG=dev-main + +# Basic requirements +RUN apt-get update +RUN apt-get install -yqq --no-install-recommends default-mysql-client acl iproute2 zip zlib1g-dev libzip-dev \ + libxml2-dev libpng-dev libghc-curl-dev libldb-dev libldap2-dev gnupg2 libpq-dev sqlite3 + +# Installing postgresql-client-16 +RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc| gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg && \ + sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \ + apt-get update && apt-get install -y postgresql-16 + +# PHP required extensions +RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql +RUN docker-php-ext-install -j$(nproc) pgsql pdo_pgsql pdo mysqli pdo_mysql zip xml gd curl bcmath +RUN docker-php-ext-enable pdo_pgsql pdo_mysql sodium + +# SQL Server support +ENV ACCEPT_EULA=Y +RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - +RUN curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list +RUN apt-get update +RUN apt-get -y --no-install-recommends install msodbcsql18 unixodbc-dev +RUN pecl install sqlsrv +RUN pecl install pdo_sqlsrv +RUN docker-php-ext-enable sqlsrv pdo_sqlsrv + +# Cleanup. +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY --from=composer /usr/bin/composer /usr/bin/composer + +WORKDIR /var/www + +RUN composer require makinacorpus/db-tools-bundle $TAG + +ENTRYPOINT ["/var/www/vendor/bin/db-tools"] diff --git a/docker/franken-image/logo-ascii b/docker/franken-image/logo-ascii new file mode 100644 index 0000000..0d5a5ad --- /dev/null +++ b/docker/franken-image/logo-ascii @@ -0,0 +1,30 @@ + .-+++++++++++. + -+++++++++++++++++++++++++ + ++++++++++-..........-++++++++++ + -++++++........................++++++- + +++++..............................+++++ + ++++..................................++++ +-+++....................................++++ +++++....................................++++ ++++++..................................+++++ ++++++++..............................-++++++ ++++++++++-.........................+++++++++ +++++ +++++++++-..............-+++++++++ ++++ +++++ .++++++++++++++++++++++++++- ++++ +++++ .++++++++++++++++. ++++ ++++++ +++++ ++++++++ +++++++ +++++++++++ ++++++++++ +++++ .+++++++++- .+++++++++- ++++ -++++ +++++ ++++++++++++++++++++++++++ ++++++..+++ +-+++ .++++++++++++++. ++....++ + ++++ +++...++. +++ + +++++ ++.++...++ +++.++ + -++++++ +++++-++....+++++..-+. + ++++++++++. .++++++++++ ++-..........++ + -++++++++++++++++++++++++- +++...-......++- + .++++++++++++. +++...+++++++++ + ++-....++ + ++....++- + ++..-++ + -+++ \ No newline at end of file From 984e417b9fbfa9e94956bcd0910ece509ea51eff Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Fri, 29 Nov 2024 11:06:44 +0100 Subject: [PATCH 2/4] Add docker cli image --- .github/workflows/build-and-publish-ci-image.yml | 2 +- .../workflows/build-and-publish-franken-image.yml | 4 ++-- .github/workflows/continuous-integration.yml | 12 ++++++------ docker/franken-image/Dockerfile | 11 ++++++++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-publish-ci-image.yml b/.github/workflows/build-and-publish-ci-image.yml index 808712b..bb35797 100644 --- a/.github/workflows/build-and-publish-ci-image.yml +++ b/.github/workflows/build-and-publish-ci-image.yml @@ -34,7 +34,7 @@ jobs: id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: - images: simonmellerin/db-tools-bundle-ci + images: makinacorpus/db-tools-bundle-ci - name: Build and push Docker image uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 diff --git a/.github/workflows/build-and-publish-franken-image.yml b/.github/workflows/build-and-publish-franken-image.yml index 76f6c4e..1cd22c6 100644 --- a/.github/workflows/build-and-publish-franken-image.yml +++ b/.github/workflows/build-and-publish-franken-image.yml @@ -38,7 +38,7 @@ jobs: id: meta uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: - images: simonmellerin/db-tools-bundle + images: makinacorpus/db-tools-bundle - name: Build and push Docker image uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 @@ -46,5 +46,5 @@ jobs: context: . file: docker/franken-image/Dockerfile push: true - tags: ${{ steps.meta.outputs.tags == 'main' && 'latest' || steps.meta.outputs.tags }} + tags: ${{ steps.meta.outputs.tags == 'main' && 'unstable' || steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bd108be..cf5caf5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -24,7 +24,7 @@ jobs: name: "PHPUnit with PHP version matrix" runs-on: ubuntu-latest container: - image: simonmellerin/db-tools-bundle-ci:main + image: makinacorpus/db-tools-bundle-ci:main strategy: matrix: @@ -89,7 +89,7 @@ jobs: name: "PHPUnit with PostgreSQL" runs-on: ubuntu-latest container: - image: simonmellerin/db-tools-bundle-ci:main + image: makinacorpus/db-tools-bundle-ci:main needs: "phpunit-smoke-tests" strategy: @@ -152,7 +152,7 @@ jobs: name: "PHPUnit with MariaDB" runs-on: ubuntu-latest container: - image: simonmellerin/db-tools-bundle-ci:main + image: makinacorpus/db-tools-bundle-ci:main needs: "phpunit-smoke-tests" strategy: @@ -218,7 +218,7 @@ jobs: name: "PHPUnit with MySQL" runs-on: ubuntu-latest container: - image: simonmellerin/db-tools-bundle-ci:main + image: makinacorpus/db-tools-bundle-ci:main needs: "phpunit-smoke-tests" strategy: @@ -283,7 +283,7 @@ jobs: # name: "PHPUnit with SQL Server" # runs-on: ubuntu-latest # container: - # image: simonmellerin/db-tools-bundle-ci:main + # image: makinacorpus/db-tools-bundle-ci:main # needs: "phpunit-smoke-tests" # strategy: @@ -346,7 +346,7 @@ jobs: name: "PHPUnit with SQLite" runs-on: ubuntu-latest container: - image: simonmellerin/db-tools-bundle-ci:main + image: makinacorpus/db-tools-bundle-ci:main needs: "phpunit-smoke-tests" strategy: diff --git a/docker/franken-image/Dockerfile b/docker/franken-image/Dockerfile index 8eff257..33a65b9 100644 --- a/docker/franken-image/Dockerfile +++ b/docker/franken-image/Dockerfile @@ -1,5 +1,6 @@ FROM dunglas/frankenphp:1-php8.3 ARG TAG=dev-main +ARG EXTRA_COMPOSER_REQUIREMENTS='' # Basic requirements RUN apt-get update @@ -33,6 +34,14 @@ COPY --from=composer /usr/bin/composer /usr/bin/composer WORKDIR /var/www -RUN composer require makinacorpus/db-tools-bundle $TAG +RUN composer require \ + makinacorpus/db-tools-bundle:$TAG \ + symfony/password-hasher:* \ + # TODO uncomment these lines when those packages + # will have a compatible version available + # on packagist + # db-tools-bundle/pack-fr-fr:$TAG \ + # db-tools-bundle/pack-faker:$TAG \ + $EXTRA_COMPOSER_REQUIREMENTS ENTRYPOINT ["/var/www/vendor/bin/db-tools"] From 99460bf7d8ad17ac5f4e414fa50387bb7784ab7d Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Mon, 2 Dec 2024 09:22:51 +0100 Subject: [PATCH 3/4] Add docker cli image --- docker/franken-image/logo-ascii | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 docker/franken-image/logo-ascii diff --git a/docker/franken-image/logo-ascii b/docker/franken-image/logo-ascii deleted file mode 100644 index 0d5a5ad..0000000 --- a/docker/franken-image/logo-ascii +++ /dev/null @@ -1,30 +0,0 @@ - .-+++++++++++. - -+++++++++++++++++++++++++ - ++++++++++-..........-++++++++++ - -++++++........................++++++- - +++++..............................+++++ - ++++..................................++++ --+++....................................++++ -++++....................................++++ -+++++..................................+++++ -+++++++..............................-++++++ -+++++++++-.........................+++++++++ -++++ +++++++++-..............-+++++++++ ++++ -++++ .++++++++++++++++++++++++++- ++++ -++++ .++++++++++++++++. ++++ -+++++ +++++ -+++++++ +++++++ -++++++++++ ++++++++++ -++++ .+++++++++- .+++++++++- ++++ -++++ -++++ ++++++++++++++++++++++++++ ++++++..+++ --+++ .++++++++++++++. ++....++ - ++++ +++...++. +++ - +++++ ++.++...++ +++.++ - -++++++ +++++-++....+++++..-+. - ++++++++++. .++++++++++ ++-..........++ - -++++++++++++++++++++++++- +++...-......++- - .++++++++++++. +++...+++++++++ - ++-....++ - ++....++- - ++..-++ - -+++ \ No newline at end of file From 67f4ace0a6bfb62ac0fce3bc2945ab27b47033ab Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Mon, 2 Dec 2024 13:49:14 +0100 Subject: [PATCH 4/4] wording --- .github/workflows/build-and-publish-ci-image.yml | 2 +- .github/workflows/build-and-publish-franken-image.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-publish-ci-image.yml b/.github/workflows/build-and-publish-ci-image.yml index bb35797..0c7341f 100644 --- a/.github/workflows/build-and-publish-ci-image.yml +++ b/.github/workflows/build-and-publish-ci-image.yml @@ -14,7 +14,7 @@ env: jobs: build-and-push-image: - name: Push Docker ci image to Docker Hub + name: Push Docker CI image to Docker Hub runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/build-and-publish-franken-image.yml b/.github/workflows/build-and-publish-franken-image.yml index 1cd22c6..33327e5 100644 --- a/.github/workflows/build-and-publish-franken-image.yml +++ b/.github/workflows/build-and-publish-franken-image.yml @@ -1,4 +1,4 @@ -name: Build Docker franken image +name: Build Docker FrankenPHP image on: push: @@ -18,7 +18,7 @@ env: jobs: build-and-push-image: - name: Push Docker image to Docker Hub + name: Push Docker FrankenPHP image to Docker Hub runs-on: ubuntu-latest permissions: contents: read