Skip to content

Commit

Permalink
Merge pull request #1 from kohanaxworld/travis-devel
Browse files Browse the repository at this point in the history
Add Init ubuntu:24.04 (PHP 7.3 + PHP 8.3) redis-server + memcached
  • Loading branch information
phpclub committed Jun 9, 2024
2 parents 8712cbe + d616664 commit 92215ee
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
FROM ubuntu:24.04
MAINTAINER "Kohana World Team"

# noninteractive to prevent user input forms
ARG DEBIAN_FRONTEND=noninteractive

ARG TZ=Etc/UTC

# Set ENV treavis_test to 1 (true) - This can be used inside Unittests to detrmine the env
ENV TRAVIS_TEST=1;

# Install Required Packages
# First add 'deb-src' so we can 'build-dep'
# Update an upgrade system
# Install (without recommends and silent) basic system tools and required libs
# Add PHP 7.3 repository and install php7.3 with all required extensions
# Finally: install composer and configure services
RUN cp /etc/apt/sources.list /etc/apt/sources.list~ && \
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list && \
apt-get update && \
apt-get -qq install --no-install-recommends apt-utils software-properties-common htop nano && \
add-apt-repository ppa:ondrej/php && \
apt-get update && \
apt-get -qq upgrade && \
apt-get -qq install ca-certificates \
language-pack-en \
curl \
unzip \
wget \
gcc \
git \
libcurl4-openssl-dev \
libde265-dev \
libwebp-dev \
libmagic-dev \
libmcrypt-dev \
libmemcached11 \
libmemcachedutil2 \
libmemcached-dev \
libmagickwand-dev \
zlib1g-dev \
zlib1g \
imagemagick \
webp \
tzdata && \
apt-get -qq install --no-install-recommends \
redis-server \
memcached \
php-dev \
php-pear && \
echo "requirepass password" >> /etc/redis/redis.conf && \
sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis/redis.conf && \
pear update-channels && \
pecl upgrade timezonedb && \
apt-get -qq install --no-install-recommends \
php7.3-dev \
php7.3 \
php7.3-apcu \
php7.3-common \
php7.3-cli \
php7.3-mbstring \
php7.3-gd \
php7.3-mysql \
php7.3-curl \
php7.3-xml \
php7.3-sqlite3 \
php7.3-opcache \
php7.3-pgsql \
php7.3-mysql \
php7.3-intl \
php7.3-raphf \
php7.3-mcrypt \
php7.3-apcu \
php7.3-gmagick \
php7.3-mcrypt \
php7.3-propro \
php7.3-redis && \
update-alternatives --set php /usr/bin/php7.3 && \
update-alternatives --set phpize /usr/bin/phpize7.3 && \
update-alternatives --set php-config /usr/bin/php-config7.3 && \
printf "\n" | pecl install memcache-4.0.5.2 && \
echo 'extension=memcache.so' >> /etc/php/7.3/cli/php.ini && \
echo 'apc.enabled=1' >> /etc/php/7.3/cli/php.ini && \
echo 'apc.enable_cli=1' >> /etc/php/7.3/cli/php.ini && \
echo "\n" | pecl install xdebug-3.1.6 && \
echo 'zend_extension=/usr/lib/php/20180731/xdebug.so' >> /etc/php/7.3/cli/php.ini && \
echo 'xdebug.mode = coverage ' >> /etc/php/7.3/cli/php.ini && \
apt-get -qq install --no-install-recommends \
php-curl \
php-xdebug \
php-redis \
php-pear \
php-yaml \
php-gd \
php-http \
php-raphf \
php-mcrypt \
php-mbstring \
php-memcache \
php-sqlite3 \
php-mysql \
php-pgsql \
php-apcu \
php-gmagick && \
echo 'xdebug.mode = coverage ' >> /etc/php/8.3/cli/php.ini && \
echo 'apc.enabled=1' >> /etc/php/8.3/cli/php.ini && \
echo 'apc.enable_cli=1' >> /etc/php/8.3/cli/php.ini && \
apt-get -qq remove gcc php-dev php7.3-dev && \
echo 'Y' | apt -qq autoremove && \
rm -rf /var/lib/apt/lists/*

RUN curl -s https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
mkdir -p /tmp/kohana
98 changes: 96 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,96 @@
# docker
Kohana Docker Images ( kohana.world, koseven, modseven)
# Kohana.World Docker Images ( kohana.world, koseven, modseven)
![License](https://img.shields.io/badge/license-BSD--3--Clause-green.svg)

This repository holds docker images which can be used for Kohana Framework.

There will be 4 branches which all server a different purpose:

| Branch | Purpose |
| --------------- |---------------------------------------------------------------------------------------------|
| master | Image for a development/production environment. |
| travis | Image for Unit-Testing inside Travis CI (CAREFUL: Don't use on production servers.) |
| devel | Development Branch for `master`. Only latest `kohana:devel` version will be supproted. |
| travis-devel | Development Branch for `travis`. Only latest `kohana:devel` version will be supproted. |

## Using the container images

Using one of the container is quite straight forward.
The docker repository for them is called `kohanaworld/docker`.

By specifying the desired branch as docker-tag you can acquire the desired image.

_Note: for pulling the `master` branch use `latest` as tag name._

e.g. This will pull the master branch image:
`docker pull kohanaworld/docker:latest`

e.g This will pull the travis branch image:
`docker pull kohanaworld/docker:travis-devel`

After executing the `docker pull` command from above you're done setting up
your docker image, now you can go ahead and use it!

## Example for using `master` image

__Coming Soon. Stay tuned!__

## Example for using `travis-devel` image

For this particular Image you have multiple options.

1. Some IDE's ([PHPStorm](https://intellij-support.jetbrains.com/hc/en-us/community/posts/14391537025170-PHPUnittests-via-docker-by-PHPStorm-Configuration) for example) have full support for docker unittesting, you just need to configure it there and
you are good to go!

2. Run the tests from the cli. Execute the following cli commands (from within your Kohana installation folder):
Start container in background and mount installation folder:

```shell
docker stop unittest && docker rm unittest
docker run -dtP --name unittest -v $(pwd):/tmp/kohana/ kohanaworld/docker:travis-devel
```

3. Start services, install composer requirements and run PHPUnit
```shell
docker exec unittest /bin/sh -c "service redis-server start; service memcached start"
cd /tmp/kohana
update-alternatives --config php
# switch php version
composer install
php vendor/bin/phpunit"
```
_(Hint) You can execute a `/bin/bash` shell inside the container and modify it before Unit-Testing
```shell
docker exec -it unittest /bin/bash
cd /tmp/kohana
```
_(Hint) You can execute a single test
```shell
docker exec -it unittest /bin/bash
cd /tmp/kohana
composer install
php vendor/bin/phpunit --filter HTMLTest
php vendor/bin/phpunit --filter HTMLTest --debug
```
_
For more examples / tutorials how to create and interact with container visit the official [Docker Help](https://docs.docker.com/get-started/)
## Roadmap
| Target | Release date |
| ---------------------- |--------------|
| Initial `master` image | 2024.07.01 |
| Initial `travis` image | 2024.06.16 |
| Initial `travis-devel` | 2024.06.09 |
## Contributing
As usual, [fork and send pull requests](https://github.com/kohanaxworld/docker/pulls)
## Getting Help
* Open issues in this project.
## TODO

0 comments on commit 92215ee

Please sign in to comment.