Skip to content

Commit 4c0fdc3

Browse files
committed
feat: initial repository commit
0 parents  commit 4c0fdc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2019
-0
lines changed

.cz.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[tool]
2+
[tool.commitizen]
3+
name = "cz_conventional_commits"
4+
version = "1.0.0"
5+
tag_format = "v$version"

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.{yml,yaml}]
12+
indent_size = 2

.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
3+
version: 2
4+
updates:
5+
# Maintain dependencies for GitHub Actions
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"

.github/workflows/ci.yml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'master'
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php_version: ['7.4', '8.0', '8.1']
21+
php_type: ['fpm', 'cli', 'supervisord']
22+
os_version: ['alpine']
23+
steps:
24+
- uses: e1himself/[email protected]
25+
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
29+
- name: Set Environment Variables
30+
env:
31+
IMAGE_NAMESPACE: wayofdev/php-dev
32+
TEMPLATE: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_version }}
33+
run: |
34+
export RELEASE_VERSION=${GITHUB_REF#refs/*/}
35+
echo "IMAGE_NAMESPACE=${IMAGE_NAMESPACE}" >> $GITHUB_ENV
36+
echo "TEMPLATE=${TEMPLATE}" >> $GITHUB_ENV
37+
echo "VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
38+
39+
- name: Docker Meta
40+
id: meta
41+
uses: docker/metadata-action@v3
42+
with:
43+
images: ${{ env.IMAGE_NAMESPACE }}
44+
tags: |
45+
type=raw,event=branch,value=latest
46+
type=ref,event=pr
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
flavor: |
50+
latest=false
51+
prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_version }}-
52+
53+
- name: Login to DockerHub
54+
if: github.event_name != 'pull_request'
55+
uses: docker/login-action@v1
56+
with:
57+
username: ${{ secrets.DOCKER_USERNAME }}
58+
password: ${{ secrets.DOCKER_TOKEN }}
59+
60+
#
61+
### For Cross Platform OSX builds uncomment these lines
62+
#
63+
# - name: Set up QEMU
64+
# uses: docker/setup-qemu-action@v1
65+
# with:
66+
# platforms: arm64
67+
#
68+
# - name: Set up Docker Buildx
69+
# uses: docker/setup-buildx-action@v1
70+
# with:
71+
# install: true
72+
73+
- name: Build and Export to Docker
74+
uses: docker/build-push-action@v2
75+
with:
76+
context: ./dist/dev/${{ env.TEMPLATE }}
77+
load: true
78+
tags: ${{ steps.meta.outputs.tags }}
79+
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}
80+
cache-to: type=inline
81+
labels: ${{ steps.meta.outputs.labels }}
82+
83+
- name: Test Docker Release Image
84+
if: success() && startsWith(github.ref, 'refs/tags/')
85+
run: |
86+
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-${{ env.VERSION }} make test
87+
88+
- name: Test Docker Master Image
89+
if: success() && ! startsWith(github.ref, 'refs/tags/')
90+
run: |
91+
IMAGE_TAG=${{ env.IMAGE_NAMESPACE }}:${{ env.TEMPLATE }}-latest make test
92+
93+
- name: Push Docker Image
94+
uses: docker/build-push-action@v2
95+
with:
96+
context: ./dist/dev/${{ env.TEMPLATE }}
97+
### For Cross Platform OSX builds uncomment these lines
98+
# platforms: linux/amd64,linux/arm64
99+
push: ${{ github.event_name != 'pull_request' }}
100+
tags: ${{ steps.meta.outputs.tags }}
101+
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}
102+
cache-to: type=inline

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

.pre-commit-config.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
3+
repos:
4+
- hooks:
5+
- id: commitizen
6+
stages:
7+
- commit-msg
8+
repo: https://github.com/commitizen-tools/commitizen
9+
rev: v2.20.0

.yamllint

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: default
3+
4+
# Overwrite above default rules
5+
rules:
6+
colons:
7+
max-spaces-before: 0
8+
max-spaces-after: 60
9+
comments:
10+
require-starting-space: true
11+
min-spaces-from-content: 1
12+
line-length: disable

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 @lotyp <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
IMAGE_NAMESPACE ?= wayofdev/php-dev
2+
TEMPLATE ?= 8.0-cli-alpine
3+
4+
5+
6+
########################################################################################################################
7+
# Most likely there is nothing to change behind this line
8+
########################################################################################################################
9+
10+
IMAGE_TAG ?= $(IMAGE_NAMESPACE):$(TEMPLATE)-latest
11+
DOCKERFILE_DIR ?= ./dist/dev/$(TEMPLATE)
12+
CACHE_FROM ?= $(IMAGE_TAG)
13+
OS ?= $(shell uname)
14+
CURRENT_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
15+
16+
all: build test
17+
PHONY: all
18+
19+
build:
20+
cd $(CURRENT_DIR)$(DOCKERFILE_DIR); \
21+
docker build . -t $(IMAGE_TAG)
22+
PHONY: build
23+
24+
build-from-cache:
25+
cd $(CURRENT_DIR)$(DOCKERFILE_DIR); \
26+
docker build --cache-from $(CACHE_FROM) . -t $(IMAGE_TAG)
27+
PHONY: build-from-cache
28+
29+
test:
30+
set -eux
31+
GOSS_FILES_STRATEGY=cp GOSS_FILES_PATH=$(DOCKERFILE_DIR) dgoss run -t $(IMAGE_TAG)
32+
.PHONY: test
33+
34+
pull:
35+
docker pull $(IMAGE_TAG)
36+
.PHONY: pull
37+
38+
push:
39+
docker push $(IMAGE_TAG)
40+
.PHONY: push
41+
42+
ssh:
43+
docker run --rm -it -v $(PWD)/:/opt/docker-php-core $(IMAGE_TAG) sh
44+
.PHONY: ssh
45+
46+
install-hooks:
47+
pre-commit install --hook-type commit-msg
48+
.PHONY: install-hooks
49+
50+
51+
52+
########################################################################################################################
53+
# Ansible
54+
########################################################################################################################
55+
56+
generate:
57+
ansible-playbook src/generate.yml
58+
PHONY: generate
59+
60+
clean:
61+
rm -rf ./dist/*
62+
PHONY: clean

ansible.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[defaults]
2+
roles_path = ./src/roles
3+
inventory = ./src/inventory.yml
4+
interpreter_python = auto_silent

dist/dev/7.4-cli-alpine/Dockerfile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Auto-generated via Ansible: edit src/Dockerfiles/dev/Dockerfile.j2 instead.
2+
3+
FROM wayofdev/php-prod:7.4-cli-alpine-latest
4+
5+
# Labels
6+
# https://github.com/opencontainers/image-spec/blob/main/annotations.md
7+
LABEL "maintainer"="lotyp <[email protected]>"
8+
LABEL "vendor"="wayofdev"
9+
LABEL "org.opencontainers.image.authors"="lotyp <[email protected]>"
10+
LABEL "org.opencontainers.image.url"="https://hub.docker.com/r/wayofdev/php-dev"
11+
LABEL "org.opencontainers.image.documentation"="https://github.com/wayofdev/docker-php-dev"
12+
LABEL "org.opencontainers.image.source"="https://github.com/wayofdev/docker-php-dev"
13+
LABEL "org.opencontainers.image.vendor"="wayofdev"
14+
LABEL "org.opencontainers.image.licenses"="MIT"
15+
LABEL "org.opencontainers.image.ref.name"="7.4-dev"
16+
LABEL "org.opencontainers.image.title"="PHP-CLI 7.4-dev"
17+
LABEL "org.opencontainers.image.description"="PHP-CLI 7.4-dev"
18+
19+
USER root
20+
21+
RUN set -eux; \
22+
apk -U upgrade -a \
23+
# Add production dependencies
24+
&& apk add --no-cache \
25+
git \
26+
bash \
27+
unzip \
28+
nano \
29+
# Temporary build dependencies for compiling Pecl extensions
30+
&& apk add --no-cache --virtual .temp-build-deps \
31+
$PHPIZE_DEPS \
32+
# Pecl Dependencies
33+
# Xdebug
34+
&& pecl install xdebug-3.1.2 \
35+
&& docker-php-ext-enable xdebug \
36+
# Other Dependencies
37+
# Composer
38+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
39+
&& apk add --no-cache \
40+
postgresql-client \
41+
postgis \
42+
# LibFakeTime - Dynamically change time in docker containers
43+
# Adding the faketime library to the preload file needs to be done last.
44+
# Otherwise, it will preload it for all commands that follow in this file
45+
&& apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing libfaketime \
46+
&& echo "/usr/lib/faketime/libfaketime.so.1" >> /etc/ld.so.preload \
47+
&& chown -R www-data:www-data /usr/local/etc/php/conf.d/ \
48+
&& apk del -f .temp-build-deps
49+
50+
COPY --chown=www-data ./configs/99-xdebug.ini /usr/local/etc/php/conf.d/
51+
52+
USER www-data
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
2+
; https://xdebug.org/docs/all_settings
3+
;
4+
; https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
5+
[xdebug]
6+
; Note: This setting can only be set in php.ini or files like 99-xdebug.ini that are
7+
; read when a PHP process starts (directly, or through php-fpm), but not in .htaccess
8+
; and .user.ini files, which are read per-request.
9+
xdebug.mode = Off
10+
xdebug.client_host = host.docker.internal
11+
12+
; Default: 9003
13+
xdebug.client_port = 9003
14+
15+
xdebug.discover_client_host = 0
16+
xdebug.start_with_request = yes
17+
# xdebug.start_with_request = trigger
18+
xdebug.remote_handler = dbgp
19+
xdebug.max_nesting_level = 500
20+
xdebug.idekey = PHPSTORM
21+
22+
; Default: 128
23+
xdebug.var_display_max_children = -1
24+
; Default: 512
25+
xdebug.var_display_max_data = -1
26+
; Default: 3
27+
xdebug.var_display_max_depth = -1
28+
; Default: 0
29+
xdebug.cli_color = 1
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-99-xdebug.ini)
2+
; https://xdebug.org/docs/all_settings
3+
;
4+
; https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
5+
[xdebug]
6+
xdebug.mode = off
7+
# xdebug.mode = debug
8+
xdebug.client_host = host.docker.internal
9+
10+
; Default: 9003
11+
xdebug.client_port = 9003
12+
13+
xdebug.discover_client_host = 0
14+
xdebug.start_with_request = yes
15+
# xdebug.start_with_request = trigger
16+
xdebug.remote_handler = dbgp
17+
xdebug.max_nesting_level = 500
18+
xdebug.idekey = PHPSTORM
19+
20+
; Default: 128
21+
xdebug.var_display_max_children = -1
22+
; Default: 512
23+
xdebug.var_display_max_data = -1
24+
; Default: 3
25+
xdebug.var_display_max_depth = -1
26+
; Default: 0
27+
xdebug.cli_color = 1

0 commit comments

Comments
 (0)