Compare commits

...

132 Commits

Author SHA1 Message Date
d62cc85c97 schedule:work now doesnt exit immediately, add wait_for_db for queue
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 3m24s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 12m8s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 54s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 10s
2024-09-24 23:21:05 +10:00
b665751711 Minor optimisation to init
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 3m48s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 12m28s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 55s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 10s
2024-08-24 22:17:17 +10:00
f86ce8e8a8 Added intl module
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 4m4s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 14m11s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 58s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 10s
2024-07-03 22:00:43 +10:00
0cf1719488 Added gitea CI/CD configuration
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 3m0s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 8m32s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s
Create Docker Image / Build Docker Test Image (x86_64) (push) Successful in 49s
Create Docker Image / Final Docker Test Image Manifest (push) Successful in 11s
2024-04-07 20:47:00 +10:00
853f0b69d1 Ensure pecl cleans temp 2024-01-22 17:48:27 +11:00
74ffc27e6c Updated to php 8.3 2024-01-22 16:00:18 +11:00
232037d3ad Fix memcached pid dir and ownership 2024-01-09 20:18:50 +11:00
98210c41a9 Move npm to base image 2024-01-08 22:49:54 +11:00
cd26c07099 Update CI now that alpine has been merged into master 2024-01-08 21:15:39 +11:00
3056a63348 Enable armv7l build 2023-10-15 21:19:11 +11:00
4a1d0e8e56 Added /sbin/init-container execution if exists, for child images 2023-09-04 18:58:02 +10:00
d778b2599a Only trigger child builds if AUTO_BUILD defined 2023-07-01 00:02:29 +10:00
f5e4c8e300 HTTP_PROXY can now be defined with a variable 2023-06-30 23:55:32 +10:00
Deon George
4ac8e00528 Sed should be -i -e, not -ie 2023-06-26 20:14:14 +10:00
Deon George
59064cc03e Change msmtprc to use default email nobody@ 2023-05-04 20:21:20 +10:00
Deon George
6cd78fc2ad msmtprc was missing. updated msmtprc 2023-04-27 21:58:09 +10:00
Deon George
fca7560fa8 xdebug needs linux-headers 2023-04-05 23:14:31 +10:00
Deon George
0c0d80472b Minor tweak to gitlab-ci 2023-04-05 23:09:08 +10:00
Deon George
999a5e5bf6 Change our build cache to build-cache\ 2023-02-11 09:39:10 +11:00
Deon George
31a2b03d89 Laravel APP_ENV should default to production, not live 2023-02-11 09:39:10 +11:00
Deon George
12431f6c2e Disable armv7l builds and arm64 test builds 2023-02-11 09:39:09 +11:00
Deon George
e266319386 Set COMPOSER_HOME and define VOLUMEs 2023-02-11 09:39:09 +11:00
Deon George
d7b97dfce7 Change our cache key to better cache across architectures, and trigger child builds 2023-02-11 09:39:09 +11:00
Deon George
c56a9e6a53 Split out .gitlab-ci to separate files, added arm64 2023-02-11 09:39:08 +11:00
Deon George
88503c81a2 Change to use alpine, and try multi-arch building 2023-02-11 09:39:08 +11:00
Deon George
80a8203985 Test image was still building off of php 8.0 2023-01-30 23:21:01 +11:00
Deon George
2ce07e2c9a Added ZSTD 2022-10-21 09:29:00 +11:00
Deon George
26c30cb5cb Update php to 8.1 2022-07-30 10:55:41 +10:00
Deon George
a0a0c7e1e2 Added bcmath and intl modules 2022-06-26 11:42:56 +10:00
Deon George
546ebcc610 Enable migration to be ignored, even if we have to migrate 2022-02-06 15:10:24 +11:00
Deon George
6d37d4ae78 Change php memory to 512, and execution limit to 300 2022-01-20 16:23:24 +11:00
Deon George
4e50257a63 Change to stable-dind, gitlab-ci was failing on docker:dind 2022-01-06 01:01:49 +11:00
Deon George
d3b84db0e9 Update nginx-app, disabling fastcgi_buffer, gzip configuration and default timeout 600s 2022-01-05 17:31:12 +11:00
Deon George
8cf481d733 Installing npm results in systemd affecting our /sbin/init 2021-12-16 00:00:10 +11:00
Deon George
6da5ac5983 Need to remove nginx-core otherwise there are dependancy issues adding db modules 2021-12-09 23:10:45 +11:00
Deon George
3302b0d6d4 Fix run passport:keys when they already exist 2021-12-09 22:42:30 +11:00
Deon George
b1a333ea4d Use bash instead of sh 2021-07-19 00:48:50 +10:00
Deon George
06c6152085 Turn off -e when running init-php.sh 2021-07-18 23:47:31 +10:00
Deon George
194a6cfa99 Add init-php.sh execution if it exists 2021-07-17 23:11:55 +10:00
Deon George
471e5df45c Add zlib and ssl to mongo 2021-07-07 23:28:58 +10:00
Deon George
fa61e00cf0 Correct test dockerfile 2021-07-06 16:17:36 +10:00
Deon George
abe7be2afd Add mongo zip bz2 gd to base image 2021-07-06 15:44:33 +10:00
Deon George
d4e83d0c0a Merge mysql branch into master - this will be the new base image 2021-07-06 14:53:53 +10:00
Deon George
627b48852a Changes to Permission settings, to enable NGINX to read public dirs 2021-06-30 16:11:38 +10:00
Deon George
4d86334839 Change cache configuration, ensure items in public dont have +x 2021-06-24 23:34:54 +10:00
Deon George
9600a556ad Fix trigger to the right branch 2021-06-15 22:36:13 +10:00
Deon George
afe65b2618 Fix ommissions in previous commit 2021-06-09 12:34:43 +10:00
Deon George
1111afcb5f Changed NO_NGINX to NGINX_START, added REDIS/MEMCACHED startup 2021-06-09 12:12:06 +10:00
Deon George
45d16b63cb Added memcached to php 2021-06-09 11:37:15 +10:00
Deon George
d6de32b198 We also need --post301 for redirects 2021-05-27 10:11:35 +10:00
Deon George
ac0cda2818 Try with trigger token 2021-05-27 10:01:25 +10:00
Deon George
38bd78f594 Added -L to curl for redirects 2021-05-27 09:50:30 +10:00
Deon George
2e1edc3966 docker image uses apk not apt 2021-05-27 09:48:03 +10:00
Deon George
0c0f172782 Alternative attempt to trigger next branch builds 2021-05-27 09:44:36 +10:00
Deon George
f81815e789 Alternative attempt to trigger next branch builds 2021-05-27 09:30:34 +10:00
Deon George
8d8da2f5ad Increase PHP default memory limit to 256M 2021-05-27 09:06:49 +10:00
Deon George
8d34685aaa Changed dev to local, since laravel uses local for non-production deployments 2021-05-24 15:39:07 +10:00
Deon George
3868365626 Revert "Go back to PHP 8.0.3"
This reverts commit f505457e9b.
2021-05-04 11:31:21 +10:00
Deon George
f505457e9b Go back to PHP 8.0.3 2021-05-04 11:14:39 +10:00
Deon George
1667116257 Try trigger of ext after successful build 2021-05-04 10:05:12 +10:00
Deon George
e047287407 Enabled specifying additional queues to run locally 2021-05-04 09:41:22 +10:00
Deon George
c4de84d51a Add LOCAL_QUEUE process for jobs on the 'hostname' queue 2021-03-25 14:13:54 +11:00
Deon George
f2602bd98a Update to PHP 8.0 2021-03-03 13:53:44 +11:00
Deon George
e037baadeb Enable queue running for dev environments to update with current code without needing to be restarted 2021-03-03 13:38:02 +11:00
Deon George
0d799f28c7 Added npm to test image 2020-10-15 12:28:50 +11:00
Deon George
c05c67ec02 Add lumen detection to queue,schedule contianers 2020-09-17 13:24:57 +10:00
Deon George
8cc6e595e3 More silly fixes for CI 2020-08-24 16:02:28 +10:00
Deon George
c90446b059 CI fixes for test tagging 2020-08-24 15:58:49 +10:00
Deon George
b3ae5f32a3 More silly errors 2020-08-24 15:51:21 +10:00
Deon George
27eb813e57 Autoconf alread in base image 2020-08-24 15:39:43 +10:00
Deon George
1a95ead792 More typo fixes #3 2020-08-24 15:34:36 +10:00
Deon George
1cc72feebe More typo fixes #2 2020-08-24 15:29:50 +10:00
Deon George
f072369597 More typo fixes 2020-08-24 15:27:06 +10:00
Deon George
677d57b4bf Fixed typo in previous commit to Dockerfile 2020-08-23 13:01:49 +10:00
Deon George
74afe07a7b Add building additional test container 2020-08-23 12:54:50 +10:00
Deon George
d752fa113f Update to PHP 7.4 - missed .gitlab-ci 2020-07-31 16:57:05 +10:00
Deon George
7b9bd41c00 Update to PHP 7.4 2020-07-31 16:50:14 +10:00
Deon George
a62d434cef Added Lumen detection 2020-07-31 16:42:40 +10:00
Deon George
81b970b53b Added wait-for-it to wait for DB for laravel 2020-05-07 21:29:21 +10:00
Deon George
90ed5a1da6 Remove double docker pull during build 2020-04-02 15:56:47 +11:00
Deon George
90b27476b1 Make default web root public/ 2020-03-12 09:12:58 +11:00
Deon George
c8cc79dbb3 Added nginx to server static content when app is in container 2020-03-11 14:43:15 +11:00
Deon George
e87698b30c Added passport key generation 2020-03-05 14:51:24 +11:00
Deon George
b244577c76 Change queues to run --once as optional 2020-01-30 20:39:00 +11:00
Deon George
584e56aceb Changes to mountpoint logic 2020-01-29 16:01:08 +11:00
Deon George
5943f0df5a Cache config in role containers if container contains the app and change mountpoint detection routine 2020-01-29 15:37:53 +11:00
Deon George
f8bda40162 Make schedular and queue run as www-data 2020-01-29 00:11:39 +11:00
Deon George
8237c6270c Ensure removing .migrate is run as root 2020-01-28 23:10:11 +11:00
Deon George
d23d97f9dd Add marker to echo statements 2020-01-25 00:21:46 +11:00
Deon George
06e4f0dfcd Need to disable our error pipeline with mountpoint 2020-01-25 00:02:13 +11:00
Deon George
f99cd2f308 Added FORCE_PERMS 2020-01-24 23:51:41 +11:00
Deon George
3bddae369e Enhancements for containers with applications 2020-01-24 23:09:56 +11:00
Deon George
cb2da835a3 Remove more redundant debs 2020-01-22 22:02:16 +11:00
Deon George
235df69f19 Removed unnessary dev debs 2020-01-22 21:41:30 +11:00
Deon George
ab31f9a71b Clean tmp after pecl install 2020-01-20 14:36:18 +11:00
Deon George
139946ed1a Added phpredis 2020-01-20 14:28:58 +11:00
Deon George
41b4b633e2 Fix public dirs for nginx 2020-01-16 08:16:38 +11:00
Deon George
528051fe04 Skip permissions adjustments if dev mode or SKIP_PERM=1 2020-01-15 21:36:53 +11:00
Deon George
c6f4d4835b Fix test for dev mode 2020-01-15 17:53:50 +11:00
Deon George
fc50334ccf More composer file/dir ownership fixes, test for nodev, dont call event:cache 2020-01-15 17:43:25 +11:00
Deon George
1850eb68c0 Changed composer optimisation 2020-01-15 15:47:25 +11:00
Deon George
680ab60f7a Chown vendor dir to www-data 2020-01-15 15:29:34 +11:00
Deon George
ee45868bf9 Make vendor dir for laravel projects if it doesnt exist 2020-01-15 14:59:07 +11:00
Deon George
8e23589589 Added recursive chown to php root dir 2020-01-15 14:54:20 +11:00
Deon George
9b4df6abb1 Fix typo in previous commit 2020-01-15 14:50:14 +11:00
Deon George
851daf659e Updated init to set permissions 2020-01-15 14:28:57 +11:00
Deon George
6983db70d8 Increased default workers config 2019-09-09 21:41:36 +10:00
Deon George
deb99f9b10 Update PHP and add php.ini, change ssmtp to msmtp 2019-09-09 21:22:54 +10:00
Deon George
005f6b1161 sbin/init needs to be executable by www-data 2019-05-16 11:57:01 +10:00
Deon George
55e8429e75 Made migration controlled by a dot file 2019-05-14 20:01:45 +10:00
Deon George
c66b95e414 Update to php 7.3 2019-05-03 12:53:30 +10:00
Deon George
31d5266266 Removing gettext install - not required 2019-05-03 12:22:35 +10:00
Deon George
2a35efec11 Added gettext, testing for artisan and enabled migrate before starting 2019-05-03 12:09:47 +10:00
Deon George
2976938437 Added x86_64 tags, changed docker:dind service 2019-01-22 11:48:13 +11:00
Deon George
8ca1a9a192 Added ldap to base image 2019-01-22 11:06:33 +11:00
Deon George
ba4e01f18d Added libssl1.0-dev for barryvdh/laravel-snappy 2018-08-08 14:15:35 +10:00
Deon George
4c56b5723d Make composer install run as www-data 2018-05-08 15:56:49 +10:00
Deon George
9fb30c0958 Remove .composer.refresh if it exists 2018-05-08 15:50:00 +10:00
Deon George
42586535f4 Change shell to bash 2018-05-08 15:45:42 +10:00
Deon George
b3e39f7cc9 Added composer (re)installation 2018-05-08 15:36:11 +10:00
Deon George
2e0860713d Only run caching for the app 2018-05-07 13:58:55 +10:00
Deon George
9652a4baf9 Added PHP_OPTIONS 2018-05-07 13:53:29 +10:00
Deon George
ee72137f96 Enabled tuning queue:work 2018-05-07 13:45:43 +10:00
Deon George
b48c38cee1 Enabled multi-use container invocation with roles 2018-05-07 13:34:45 +10:00
Deon George
3df8ec4de2 Added git unzip, required for composer 2018-05-06 10:01:23 +10:00
Deon George
fc28d4fe09 Added postgresql module and composer 2018-05-04 23:54:52 +10:00
Deon George
5852061063 Update .gitlab-ci 2018-02-27 19:53:56 +11:00
Deon George
1322c5f0f5 Updated SSH patch for php-7.2 2018-02-27 19:40:27 +11:00
Deon George
77c7e70428 Reworked ssmtp integration, need to use fastcgi_param PHP_ADMIN_VALUE "sendmail_path=/usr/sbin/sendmail -i -t"; in nginx config, and hostname: for php container 2018-02-27 19:28:17 +11:00
Deon George
7ca57c02ab Reworked mysql image to better work as a base 2018-01-29 15:23:52 +11:00
Deon George
39fdc2f940 Added mysql only branch 2018-01-29 13:52:35 +11:00
Deon George
ea8f8a2334 Cache our builds based on branches - part 2 2018-01-29 13:47:37 +11:00
12 changed files with 539 additions and 93 deletions

View File

@ -0,0 +1,190 @@
name: Create Docker Image
run-name: ${{ gitea.actor }} Building Docker Image 🐳
on: [push]
env:
VERSION: 8.3-fpm
DOCKER_HOST: tcp://127.0.0.1:2375
jobs:
build:
strategy:
matrix:
arch:
- x86_64
- arm64
name: Build Docker Image
runs-on: docker-${{ matrix.arch }}
container:
image: docker:dind
privileged: true
env:
ARCH: ${{ matrix.arch }}
VERSIONARCH: ${{ env.VERSION }}-${{ env.ARCH }}
steps:
- name: Environment Setup
run: |
# If we have a proxy use it
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# Some pre-reqs
apk add git curl nodejs
# Start docker
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
## Some debugging info
# docker info && docker version
# env|sort
- name: Registry FQDN Setup
id: registry
run: |
registry=${{ github.server_url }}
echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT"
- name: Container Registry Login
uses: docker/login-action@v2
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.PKG_WRITE_TOKEN }}
- name: Code Checkout
uses: actions/checkout@v4
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}"
manifest:
name: Final Docker Image Manifest
runs-on: docker-x86_64
container:
image: docker:dind
privileged: true
needs: [build]
steps:
- name: Environment Setup
run: |
# If we have a proxy use it
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# Some pre-reqs
apk add git curl nodejs
# Start docker
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
- name: Registry FQDN Setup
id: registry
run: |
registry=${{ github.server_url }}
echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT"
- name: Container Registry Login
uses: docker/login-action@v2
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.PKG_WRITE_TOKEN }}
- name: Build Docker Manifest
run: |
docker manifest create ${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }} \
${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-x86_64 \
${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-arm64
docker manifest push --purge ${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}
test:
strategy:
matrix:
arch:
- x86_64
# arm64
name: Build Docker Test Image
runs-on: docker-${{ matrix.arch }}
container:
image: docker:dind
privileged: true
env:
ARCH: ${{ matrix.arch }}
VERSIONARCH: ${{ env.VERSION }}-test-${{ env.ARCH }}
needs: [manifest]
steps:
- name: Environment Setup
run: |
# If we have a proxy use it
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# Some pre-reqs
apk add git curl nodejs
# Start docker
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
## Some debugging info
# docker info && docker version
# env|sort
- name: Registry FQDN Setup
id: registry
run: |
registry=${{ github.server_url }}
echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT"
- name: Container Registry Login
uses: docker/login-action@v2
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.PKG_WRITE_TOKEN }}
- name: Code Checkout
uses: actions/checkout@v4
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile.phptest
push: true
tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}"
manifest-test:
name: Final Docker Test Image Manifest
runs-on: docker-x86_64
container:
image: docker:dind
privileged: true
needs: [test]
steps:
- name: Environment Setup
run: |
# If we have a proxy use it
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# Some pre-reqs
apk add git curl nodejs
# Start docker
( dockerd --host=tcp://0.0.0.0:2375 --tls=false & ) && sleep 3
- name: Registry FQDN Setup
id: registry
run: |
registry=${{ github.server_url }}
echo "registry=${registry##http*://}" >> "$GITHUB_OUTPUT"
- name: Container Registry Login
uses: docker/login-action@v2
with:
registry: ${{ steps.registry.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.PKG_WRITE_TOKEN }}
- name: Build Docker Manifest
run: |
docker manifest create ${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-test \
${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-test-x86_64
#${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-test-arm64
docker manifest push --purge ${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSION }}-test

View File

@ -1,42 +0,0 @@
image: docker:latest
stages:
- test
- build
variables:
BRANCH: plus
VERSION: 7.1-fpm-${BRANCH}
CACHETAG: build-${BRANCH}
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services:
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
before_script:
- docker info
- docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images
only:
- debug
build:
stage: build
script:
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} .
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
only:
- plus

View File

@ -1,23 +0,0 @@
# NAME leenooks/php
# VERSION 7.1-fpm-plus
FROM php:7.1-fpm
RUN echo "deb http://deb.debian.org/debian jessie non-free" >> /etc/apt/sources.list.d/non-free.list && apt-get update \
&& apt-get install -y pkg-config libbz2-dev libgmp-dev libpng-dev libjpeg-dev libfreetype6-dev libsnmp-dev snmp-mibs-downloader libmagickwand-dev --no-install-recommends \
&& download-mibs \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2 --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) pdo_mysql bz2 gettext sockets gmp gd pcntl snmp exif \
&& pecl install imagick && docker-php-ext-enable imagick \
&& rm -rf /var/lib/apt/lists/* /tmp/*
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/* \
&& useradd -c "Hosting Admin User" -u 1000 -g users -G www-data -d /var/www/html -M lamp
EXPOSE 9000/tcp 22/tcp
COPY sshd_config.patch /tmp
RUN (cd / && patch -p0 ) < /tmp/sshd_config.patch && rm /tmp/sshd_config.patch
COPY start /usr/local/sbin
ENTRYPOINT [ "/usr/local/sbin/start" ]
CMD ["php-fpm"]

61
docker/Dockerfile Normal file
View File

@ -0,0 +1,61 @@
# NAME docker/php
# VERSION 8.3-fpm-alpine
FROM php:8.3-fpm-alpine
# Change to http respositories, so they we can cache the install packages
RUN if [ -n ${HTTP_PROXY} ] ; then sed -i -e s'/https/http/' /etc/apk/repositories; fi
COPY docker/pecl_install /usr/local/bin/pecl_install
# Tune PHP
RUN sed -e 's/^expose_php = On/expose_php = Off/' /usr/local/etc/php/php.ini-production > /usr/local/etc/php/php.ini
RUN sed -i -e 's#^;sendmail_path =#sendmail_path = "/usr/bin/msmtp -t"#' /usr/local/etc/php/php.ini
RUN sed -i -e 's#^memory_limit = 128M#memory_limit = 256M#' /usr/local/etc/php/php.ini
RUN adduser -g "Hosting Admin User" -u 1000 -G www-data -h /var/www/html -HD lamp
# Base
RUN apk add --no-cache bash unzip zlib nginx msmtp
RUN curl -SLo /usr/local/bin/wait-for-it https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh && chmod +x /usr/local/bin/wait-for-it
# Memcache
RUN apk add --no-cache memcached libmemcached pkgconfig zlib-dev memcached-dev libmemcached-dev && \
pecl_install igbinary msgpack memcached && \
mkdir /run/memcached && chown memcached:memcached /run/memcached && \
apk del --no-cache pkgconfig zlib-dev memcached-dev libmemcached-dev
# Enable ZIP BZIP2
RUN apk add --no-cache libzip libzip-dev zlib-dev && \
docker-php-ext-install -j$(nproc) zip bz2 && \
apk del --no-cache libzip-dev zlib-dev
# Add zstd
RUN pecl_install zstd
# Add GD
RUN apk add --no-cache libjpeg libgd libpng freetype freetype-dev zlib-dev libpng-dev jpeg-dev && \
docker-php-ext-configure gd --with-freetype=/usr/include/freetype2 --with-jpeg=/usr/include/ && \
docker-php-ext-install -j$(nproc) gd && \
apk del --no-cache zlib-dev libpng-dev jpeg-dev freetype-dev
# Add intl
RUN apk add --no-cache icu icu-dev && \
docker-php-ext-install -j$(nproc) intl && \
apk del --no-cache icu-dev
# Add composer
RUN curl -4 https://getcomposer.org/installer|php -- --install-dir=/usr/local/bin --filename=composer
ENV COMPOSER_HOME=/var/cache/composer
# Other config
COPY msmtprc /etc/
COPY docker/www.conf /usr/local/etc/php-fpm.d/
COPY docker/nginx-app.conf /etc/nginx/http.d/default.conf
COPY docker/init /sbin/
RUN chmod 550 /sbin/init && chown 0:0 /sbin/init
VOLUME [ "/var/cache/composer" ]
WORKDIR /var/www/html
EXPOSE 80
ENTRYPOINT [ "/sbin/init" ]
CMD [ "php-fpm" ]

View File

@ -0,0 +1,9 @@
# NAME docker/php
# VERSION 8.3-fpm-test
FROM gitea.dege.au/docker/php:8.3-fpm
# Add xdebug
RUN apk --no-cache add linux-headers \
&& pecl_install xdebug \
&& apk --no-cache del linux-headers

182
docker/init Executable file
View File

@ -0,0 +1,182 @@
#!/bin/bash
set -e
role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-production}
php=${PHP_DIR:-/var/www/html}
composer=${COMPOSER_HOME:-/var/cache/composer}
SITE_USER=${SITE_USER:-www-data}
NGINX_START=${NGINX_START:-TRUE}
MEMCACHED_START=${MEMCACHED_START:-FALSE}
# To run a local queue, running jobs from the queue "hostname"
LOCAL_QUEUE=${LOCAL_QUEUE:-FALSE}
# Optional additional queues to run for
#LOCAL_QUEUES=
function mp() {
set +e
mountpoint -q $1
local mp=$?
set -e
echo ${mp}
}
function nginx_start() {
# Start NGINX
if [ -x /usr/sbin/nginx -a "${NGINX_START}" == "TRUE" ]; then
echo "* Starting NGINX..."
/usr/sbin/nginx -g 'daemon on; master_process on;'
fi
}
function wait_for_db() {
# Wait for DB to be active
if [ -n "${DB_HOST}" -a -n "${DB_PORT}" ]; then
while ! wait-for-it -h ${DB_HOST} -p ${DB_PORT} -t 5 -q; do
echo "? Waiting for database at ${DB_HOST}:${DB_PORT}"
sleep 1;
done
echo "- DB is active on ${DB_HOST}:${DB_PORT}"
fi
}
# Run any container setup
[ -x /sbin/init-container ] && /sbin/init-container
# General Setup
if [ -x /usr/bin/memcached -a "${MEMCACHED_START}" == "TRUE" ]; then
echo "* Starting MEMCACHED..."
/usr/bin/memcached -d -P /run/memcached/memcached.pid -u memcached
fi
# Laravel Specific
if [ -r artisan -a -e ${php}/.env ]; then
mp=$(mp ${php})
# Only adjust perms if this is an external mountpoint
if [ ${mp} -eq 0 -o -n "${FORCE_PERMS}" ] ; then
if [ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ]; then
echo "* Setting Permissions..."
# Make sure our permissions are appropraite
find ${php} -type f -exec chmod 640 {} \;
find ${php} -type d -exec chmod 750 {} \;
find ${php}/public -type f -exec chmod 644 {} \;
find ${php}/public -type d -exec chmod 755 {} \;
chmod o+rx ${php}
chmod a+rx ${php}/artisan
chown -R ${SITE_USER}:www-data ${php}
chown -R www-data:www-data ${php}/storage ${php}/bootstrap ${php}/composer.*
[ -e ${php}/vendor ] && chown -R www-data:www-data ${php}/vendor
fi
fi
# See if we need to refresh our dependancies
if [[ -r composer.json && ( -e .composer.refresh || ! -d vendor ) ]]; then
echo "* Composer installing dependancies..."
rm -f ${php}/bootstrap/cache/*.php
if [ "${env}" != "local" ]; then
NODEV="--no-dev"
fi
mp=$(mp ${composer})
if [ ${mp} -eq 0 -o -n "${FORCE_PERMS}" ] ; then
[ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ] && chown -R www-data:www-data ${composer}
[ ! -d ${php}/vendor ] && mkdir -m 750 ${php}/vendor && chown www-data:www-data ${php}/vendor
[ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ] && chmod g+w ${php}
fi
su www-data -s /bin/sh -c "composer install --optimize-autoloader ${NODEV}" && ( test -e .composer.refresh && rm -f .composer.refresh )
[ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ] && [ ${mp} -eq 0 ] && chmod g-w ${php}
fi
if [ -e .lumen ]; then
echo "* Lumen detected, not caching configuration..."
else
# We only check for non mount points, in case this container has the app inside
mp=$(mp ${php})
if [ ${mp} -eq 1 ]; then
echo "* Caching configuration..."
su www-data -s /bin/sh -c "(php artisan optimize)"
fi
fi
if [ "${role}" = "app" ]; then
if [ "${env}" != "local" ]; then
if [ -z "${IGNORE_MIGRATION}" ]; then
if [ -r .migrate ]; then
echo "* Running migration..."
# If DB_HOST not set, source the env file
[ -z "${DB_HOST}" -a -r .env ] && . .env
wait_for_db
su www-data -s /bin/sh -c "php artisan migrate" && rm -f .migrate
fi
else
[ -r .migrate ] && echo "! NOTE: Migration ignored due to IGNORE_MIGRATION"
fi
# If passport is installed
if [ -d ${php}/vendor/laravel/passport ]; then
echo "* Generating OAUTH keys ..."
set +e
su www-data -s /bin/sh -c "php artisan passport:keys"
set -e
fi
fi
nginx_start
if [ "${LOCAL_QUEUE}" = "TRUE" ]; then
echo "* Starting local queue for [$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}}] with job timeout of [${WORK_TIMEOUT:-90}], trying [${WORK_TRIES:-1}] times..."
su www-data -s /bin/sh -c "
(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &
"
fi
set +e
[ -x init-php.sh ] && su www-data -s /bin/bash "init-php.sh" &
exec /usr/local/bin/docker-php-entrypoint "$@"
elif [ "$role" = "queue" ]; then
QUEUE_CMD=work
if [ "${env}" == "local" ]; then
QUEUE_CMD=listen
fi
echo "* Running the queue..."
# We'll delay starting in case the app is caching
sleep 15
wait_for_db
su www-data -s /bin/sh -c "
while true; do
php ${PHP_OPTIONS} artisan queue:${QUEUE_CMD} --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}
done
"
elif [ "$role" = "scheduler" ]; then
echo "* Running the scheduler..."
# We'll delay starting in case the app is caching
sleep 15
su www-data -s /bin/sh -c "
while true; do
php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction
done
"
fi
else
nginx_start
echo "? NO container role \"${role}\", AND/OR no laravel install, just starting php-fpm"
exec /usr/local/bin/docker-php-entrypoint "$@"
fi

43
docker/nginx-app.conf Normal file
View File

@ -0,0 +1,43 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log off;
client_max_body_size 64m;
error_log /dev/stdout info;
fastcgi_buffering off;
fastcgi_request_buffering off;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/javascript;
index index.php index.html;
root /var/www/html/public;
server_tokens off;
set $my_https "off";
if ($http_x_forwarded_proto = "https") {
set $my_https "on";
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param HTTPS $my_https;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SERVER_NAME $host;
fastcgi_read_timeout 600s;
fastcgi_send_timeout 600s;
}
}

16
docker/pecl_install Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# This will install our PHP modules
# call peck-install module1 module2
# First install some dependancies
apk add --no-cache autoconf gcc libc-dev make
# Install the modules
for module in $@; do
pecl install -o -f ${module} && docker-php-ext-enable ${module}
done
# Clean up
rm -rf /tmp/pear
apk del --no-cache autoconf gcc libc-dev make

12
docker/www.conf Normal file
View File

@ -0,0 +1,12 @@
[www]
group = www-data
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 25
pm.max_spare_servers = 10
pm.min_spare_servers = 5
pm.start_servers = 10
user = www-data
prefix = /var/www/html
php_admin_value[memory_limit] = 512M
php_admin_value[max_execution_time] = 300

26
msmtprc Normal file
View File

@ -0,0 +1,26 @@
# A system wide configuration file is optional.
defaults
port 25
tls off
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default
# Authentication
auth off
# The SMTP smarthost
host smtp
# Envelope-from address
from nobody@%H
# Sets the argument of the SMTP EHLO
domain web
# Construct envelope-from addresses of the form "user@oursite.example"
#allow_from_override on
# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
syslog LOG_MAIL

View File

@ -1,20 +0,0 @@
--- /etc/ssh/sshd_config.orig 2017-12-13 10:12:21.098005827 +0000
+++ /etc/ssh/sshd_config 2017-12-13 10:14:11.461687661 +0000
@@ -25,7 +25,7 @@
# Authentication:
LoginGraceTime 120
-PermitRootLogin without-password
+PermitRootLogin no
StrictModes yes
RSAAuthentication yes
@@ -49,7 +49,7 @@
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
-#PasswordAuthentication yes
+PasswordAuthentication no
# Kerberos options
#KerberosAuthentication no

8
start
View File

@ -1,8 +0,0 @@
#!/bin/sh
if [ -x /usr/sbin/sshd -a "${SSH_START}" = "TRUE" ]; then
[ ! -d /var/run/sshd ] && mkdir /var/run/sshd
start-stop-daemon --start --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- -p 22
fi
exec /usr/local/bin/docker-php-entrypoint "$@"