Skip to content

Commit

Permalink
Add docker cli image
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMellerin committed Nov 22, 2024
1 parent a4fddaf commit 4d14e37
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Docker image
name: Build Docker CI image

on:
push:
Expand All @@ -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
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/build-and-publish-franken-image.yml
Original file line number Diff line number Diff line change
@@ -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 }}
38 changes: 38 additions & 0 deletions docker/franken-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
30 changes: 30 additions & 0 deletions docker/franken-image/logo-ascii
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.-+++++++++++.
-+++++++++++++++++++++++++
++++++++++-..........-++++++++++
-++++++........................++++++-
+++++..............................+++++
++++..................................++++
-+++....................................++++
++++....................................++++
+++++..................................+++++
+++++++..............................-++++++
+++++++++-.........................+++++++++
++++ +++++++++-..............-+++++++++ ++++
++++ .++++++++++++++++++++++++++- ++++
++++ .++++++++++++++++. ++++
+++++ +++++
+++++++ +++++++
++++++++++ ++++++++++
++++ .+++++++++- .+++++++++- ++++ -++++
++++ ++++++++++++++++++++++++++ ++++++..+++
-+++ .++++++++++++++. ++....++
++++ +++...++. +++
+++++ ++.++...++ +++.++
-++++++ +++++-++....+++++..-+.
++++++++++. .++++++++++ ++-..........++
-++++++++++++++++++++++++- +++...-......++-
.++++++++++++. +++...+++++++++
++-....++
++....++-
++..-++
-+++

0 comments on commit 4d14e37

Please sign in to comment.