Skip to content

Commit

Permalink
Initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Giesenow committed Dec 14, 2023
1 parent 00e33e9 commit c70a77a
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Create and publish a Docker image

on:
schedule:
- cron: '0 9 1 * *'
push:
branches:
- 'main'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/php

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: docker
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.idea
vendor/
composer.lock
docker-compose.override.yml
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "elbformat/ibexa-icon-fieldtype",
"description": "Field type to select an icon from a predefined set.",
"type": "symfony-bundle",
"license": "MIT",
"keywords": [
"ibexa",
"icon",
"field-type"
],
"authors": [
{
"name": "Hannes Giesenow",
"email": "[email protected]",
"role": "Lead Developer"
}
],
"autoload": {
"psr-4": {
"Elbformat\\IbexaIconFieldtype\\": "src/"
}
},
"require": {
"php": ">=8.1",
"ezsystems/ezplatform-core": "^2.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true,
"composer/package-versions-deprecated": true,
"php-http/discovery": false,
"symfony/flex": true,
"ibexa/post-install": true
}
}
}
16 changes: 16 additions & 0 deletions doc/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
For local development you can use docker-compose.
```bash
docker-compose run php sh
composer install
```

Enable xdebug inside the container
```bash
export XDEBUG_CONFIG="client_host=172.17.0.1 idekey=PHPSTORM"
export XDEBUG_MODE="debug"
```

Run tests
```bash
vendor/bin/phpunit
```
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2.1'
services:
php:
image: ghcr.io/elbformat/ibexa-icon-fieldtype/php
volumes:
- ./:/var/www
35 changes: 35 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM php:8.2-fpm-alpine

COPY --from=composer:2.5 /usr/bin/composer /usr/local/bin/composer

# ext-intl
RUN apk add --no-cache icu icu-data-full && \
apk add --no-cache --virtual .build-deps icu-dev && \
docker-php-ext-install intl && \
apk del .build-deps && \
rm -rf /tmp/*

#ext-xsl
RUN apk add --no-cache libxslt && \
apk add --no-cache --virtual .build-deps libxslt-dev && \
docker-php-ext-install xsl && \
apk del .build-deps && \
rm -rf /tmp/*

# xdebug
RUN apk add --no-cache --virtual .build-deps autoconf g++ make linux-headers && \
pecl install xdebug-3.2.1 && \
docker-php-ext-enable xdebug && \
apk del .build-deps && \
rm -rf /tmp/*

# ext-gd
RUN apk add --no-cache libpng libjpeg-turbo freetype && \
apk add --no-cache --virtual .build-deps libpng-dev libjpeg-turbo-dev freetype-dev && \
docker-php-ext-configure gd && \
docker-php-ext-install gd && \
apk del .build-deps && \
rm -rf /tmp/*

RUN rmdir /var/www/html
WORKDIR /var/www

0 comments on commit c70a77a

Please sign in to comment.