Skip to content

Commit

Permalink
[5.x] Added Docker images for Coolify (#173)
Browse files Browse the repository at this point in the history
* [5.x] Removed `-tidy` deprecation notes

* [5.x] Added Docker images for Coolify
  • Loading branch information
shinsenter authored Dec 10, 2024
1 parent 5379d6c commit 1d873e9
Show file tree
Hide file tree
Showing 38 changed files with 244 additions and 62 deletions.
1 change: 1 addition & 0 deletions .github/workflows/03-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
- app-cakephp4
- app-cakephp5
- app-codeigniter4
- app-coolify
- app-drupal
- app-espocrm
- app-flarum
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.

## [5.5.0] - XXXX-XX-XX

- Added Docker images for [Coolify](http://hub.docker.com/r/shinsenter/coolify).
- Various minor improvements.


Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ This setup allows for faster project initiation without additional installations
Our image tags cover PHP versions from 5.6 to 8.4,
available in `cli`, `zts`, `fpm`, `fpm-nginx`, `fpm-apache`, `roadrunner`<sup>(1)</sup>, `frankenphp`<sup>(2)</sup>, and `unit-php`<sup>(3)</sup> variants. The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.
Examples:
- `shinsenter/php:7.2-cli`
- `shinsenter/php:7.3-zts`
Expand Down Expand Up @@ -485,8 +483,6 @@ These Docker images include additional environment variables for fine-tuning con

Check our [Docker Hub](https://hub.docker.com/r/shinsenter/php/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.


## Stable Image Tags

Expand Down
5 changes: 5 additions & 0 deletions build/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ app-*)
# https://codeigniter.com/user_guide/installation/index.html
verlt "$PHP_VERSION" "7.4" && SKIP_BUILD=1
;;
coolify)
# https://coolify.io/docs/installation
BUILD_FROM_IMAGE="$DEFAULT_REPO/phpfpm-nginx"
verlt "$PHP_VERSION" "8.2" && SKIP_BUILD=1
;;
drupal)
# https://www.drupal.org/docs/getting-started/system-requirements/php-requirements
verlt "$PHP_VERSION" "8.0" && SKIP_BUILD=1
Expand Down
2 changes: 0 additions & 2 deletions src/php/base-os.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Combine official [Ubuntu](http://hub.docker.com/_/ubuntu), [Debian](http://hub.d

The Docker images are available for Debian, Ubuntu and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.
#### Ubuntu

- Docker Hub: https://hub.docker.com/r/shinsenter/ubuntu-s6
Expand Down
2 changes: 0 additions & 2 deletions src/php/with-apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ The config files here will be loaded into the Apache's default virtual host.

Check our [Docker Hub](https://hub.docker.com/r/shinsenter/phpfpm-apache/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.


## Stable Image Tags

Expand Down
2 changes: 0 additions & 2 deletions src/php/with-f8p.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ services:
Check our [Docker Hub](https://hub.docker.com/r/shinsenter/frankenphp/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.
> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Stable Image Tags
Expand Down
2 changes: 0 additions & 2 deletions src/php/with-nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ The config files here will be loaded into the Nginx's default server.

Check our [Docker Hub](https://hub.docker.com/r/shinsenter/phpfpm-nginx/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.


## Stable Image Tags

Expand Down
2 changes: 0 additions & 2 deletions src/php/with-roadrunner.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ services:
Check our [Docker Hub](https://hub.docker.com/r/shinsenter/roadrunner/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.
> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Stable Image Tags
Expand Down
2 changes: 0 additions & 2 deletions src/php/with-unit.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ services:
Check our [Docker Hub](https://hub.docker.com/r/shinsenter/unit-php/tags) for all available platforms. The Docker images are available for both Debian and Alpine versions.
> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Stable Image Tags
Expand Down
2 changes: 0 additions & 2 deletions src/webapps/bedrock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
2 changes: 0 additions & 2 deletions src/webapps/cakephp4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
2 changes: 0 additions & 2 deletions src/webapps/cakephp5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
2 changes: 0 additions & 2 deletions src/webapps/codeigniter4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
148 changes: 148 additions & 0 deletions src/webapps/coolify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# shinsenter/coolify

🔋 (PHP / Coolify) Production-ready Docker images with automatic Coolify installer.

- Docker Hub: https://hub.docker.com/r/shinsenter/coolify
- GitHub Packages: https://code.shin.company/php/pkgs/container/coolify

The Docker images are available for both Debian and Alpine versions.


## Introduction

Our PHP Docker images, available on [Docker Hub](https://hub.docker.com/r/shinsenter/php),
are designed for easy configuration of PHP and PHP-FPM settings via environment variables.
This approach eliminates the need to rebuild images when making configuration changes.

These images also come with the latest version of [Composer](https://getcomposer.org),
enabling you to start projects quickly without additional installations.


## Usage

[![shinsenter/php](https://repository-images.githubusercontent.com/458053748/17acf331-c504-4105-b692-1c0c02337085)](https://docker.shin.company/php)

Check out [our documentation](https://hub.docker.com/r/shinsenter/php) to learn how to customize these Docker images for your projects.


## Creating a New Project

When you mount an empty directory into the container, it will automatically download the entire source code for the framework, allowing you to bootstrap a new project quickly.

### Steps to Create a New Project

1. Create an empty directory on your host machine for your project code. For example:

```shell
mkdir myproject
```

2. Run the container and mount the empty directory as a volume. For example:

```shell
docker run -p 80:80 -p 443:443 -p 443:443/udp \
-v ./myproject:/var/www/html \
shinsenter/coolify:latest
```

The container will detect the empty directory mounted to `/var/www/html` and clone the framework source code into it.


## Using an Existing Project

You can mount your application code from your host machine to the `/var/www/html` directory inside the container.

Because the source code is mounted as a volume,
any changes made on the host machine will be reflected inside the container.
This setup allows you to run builds, tests,
and other tasks within the container while keeping your code on the host.


## Using HTTPS

The Docker images come with pre-generated SSL certificate files for testing HTTPS locally:

- /etc/ssl/site/server.crt
- /etc/ssl/site/server.key

To use valid HTTPS certificates for your production website,
replace these files with your own valid SSL certificates.
You can do this by copying or mounting your certificates from the host machine into the container.
Simply overwrite the default certificate files with your valid certificate and key files
to enable true HTTPS for your production website.

#### Using Dockerfile

```Dockerfile
FROM shinsenter/coolify:latest

# Copy your own certs into the container
COPY my_domain.crt /etc/ssl/site/server.crt
COPY my_domain.key /etc/ssl/site/server.key

# Add your instructions here
# For example:
# ADD --chown=$APP_USER:$APP_GROUP ./myproject/ /var/www/html/
```

#### Using docker run

```shell
docker run -p 80:80 -p 443:443 -p 443:443/udp \
-v ./myproject:/var/www/html \
-v ./my_domain.crt:/etc/ssl/site/server.crt \
-v ./my_domain.key:/etc/ssl/site/server.key \
shinsenter/coolify:latest
```

#### Using docker-compose

```yml
services:
web:
image: shinsenter/coolify:latest
volumes:
- ./myproject:/var/www/html
- ./my_domain.crt:/etc/ssl/site/server.crt
- ./my_domain.key:/etc/ssl/site/server.key
```
## Stable Image Tags
The release versions on [this GitHub repository](https://code.shin.company/php) don't guarantee
that Docker images built from the same source code will always be identical.
We build new Docker images daily to ensure they stay up-to-date
with the latest upstream updates for PHP, base OS, Composer, etc.
The images in this repo are regularly updated under the same tag names.
But you can pull the image from `shinsenter/coolify:latest`,
and tag it with a name that indicates its stability,
such as `your-repo/coolify:stable` using the below commands:

```shell
docker pull shinsenter/coolify:latest
docker tag shinsenter/coolify:latest your-repo/coolify:stable
docker push your-repo/coolify:stable
```

Then use the image `your-repo/coolify:stable` as a base image to build containers for production.


## Contributing

If you find these images useful, consider donating via [PayPal](https://www.paypal.me/shinsenter) or opening an issue on [GitHub](https://code.shin.company/php/issues/new).

Your support helps maintain and improve these images for the community.


## License

This project is licensed under the terms of the [GNU General Public License v3.0](https://code.shin.company/php/blob/main/LICENSE).

I appreciate you respecting my intellectual efforts in creating them. If you intend to copy or use ideas from this project, please give proper credit.

---

From Vietnam 🇻🇳 with love.
75 changes: 75 additions & 0 deletions src/webapps/coolify/coolify.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# syntax = devthefuture/dockerfile-x:v1
################################################################################
# The setups in this file belong to the project https://code.shin.company/php
# I appreciate you respecting my intellectual efforts in creating them.
# If you intend to copy or use ideas from this project, please credit properly.
# Author: SHIN Company <[email protected]>
# License: https://code.shin.company/php/blob/main/LICENSE
################################################################################

# Enable SBOM attestations
# See: https://docs.docker.com/build/attestations/sbom/
ARG BUILDKIT_SBOM_SCAN_CONTEXT=true
ARG BUILDKIT_SBOM_SCAN_STAGE=true

################################################################################

ARG BUILD_FROM_IMAGE=${BUILD_FROM_IMAGE:-shinsenter/phpfpm-nginx}
ARG BUILD_TAG_PREFIX=${BUILD_TAG_PREFIX:-}

ARG PHP_VERSION=${PHP_VERSION:-8.4}
ARG PHP_VARIANT=${PHP_VARIANT:-}

FROM ${BUILD_FROM_IMAGE}:${BUILD_TAG_PREFIX}php${PHP_VERSION}${PHP_VARIANT}
ONBUILD RUN hook onbuild

################################################################################

ADD --link ./rootfs/ /
COPY --link --chmod=755 --from=minio/mc:latest /usr/bin/mc /usr/bin/mc

################################################################################

# https://github.com/coollabsio/coolify
ENV DOCUMENT_ROOT="/public"
ENV DISABLE_AUTORUN_GENERATING_INDEX=1
ENV COOLIFY_ENABLE_HORIZON=1
RUN env-default INITIAL_PROJECT "https://codeload.github.com/coollabsio/coolify/legacy.tar.gz/refs/tags/$(curl --retry 3 --retry-delay 5 -ksLRJ https://api.github.com/repos/coollabsio/coolify/releases/latest | grep "tag_name" | cut -d \" -f 4)?ext=.tar.gz"

# https://coolify.io/docs/installation
ENV PHP_POST_MAX_SIZE="256M"
ENV PHP_UPLOAD_MAX_FILESIZE="256M"
ENV QUEUE_CONNECTION=sync

################################################################################

RUN <<'EOF'
echo 'Configure Coolify'
[ -z "$DEBUG" ] || set -ex && set -e

# install pgsql php extension
phpaddmod pdo_pgsql pgsql

# create Horizon services
if has-cmd s6-service; then
s6-service horizon longrun '#!/usr/bin/env sh
if is-true $COOLIFY_ENABLE_HORIZON; then
export APP_PATH="$(app-path)"
export APP_ROOT="$(app-root)"
cd $APP_PATH && exec artisan start:horizon
else
exec s6-svc -Od .
fi
'
fi

# make artisan command alias
web-cmd artisan 'php $(app-path)/artisan'

EOF

################################################################################

INCLUDE ./meta

################################################################################
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
APP_PATH="$(app-path)"
APP_ROOT="$(app-root)"

if [ ! -e "$APP_PATH/.env" ] && [ -e "$APP_PATH/.env.development.example" ]; then
cp -p "$APP_PATH/.env.development.example" "$APP_PATH/.env"
php $APP_PATH/artisan key:generate
fi
5 changes: 5 additions & 0 deletions src/webapps/coolify/rootfs/startup/boot-coolify
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
APP_PATH="$(app-path)"
APP_ROOT="$(app-root)"

debug-echo "Your web application must be in {$APP_PATH}."
2 changes: 0 additions & 2 deletions src/webapps/drupal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
2 changes: 0 additions & 2 deletions src/webapps/espocrm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

The Docker images are available for both Debian and Alpine versions.

> ℹ️ Note: We no longer maintain the `-tidy` tag names. If you are using Docker images with this tag, please replace them with the `-alpine` variant.

## Introduction

Expand Down
Loading

0 comments on commit 1d873e9

Please sign in to comment.