-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
/.github export-ignore | ||
/config export-ignore | ||
/docker export-ignore | ||
/make export-ignore | ||
/tests export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/Makefile export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$(shell cp -n make/dev/infrastructure/.env.dist .env && mkdir -p ./var) | ||
|
||
include ./.env | ||
export $(shell sed 's/=.*//' ./.env) | ||
|
||
-include ./make/${APP_ENV}/**/*.mk | ||
-include ./make/${APP_ENV}/*.mk | ||
|
||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) | ||
$(eval $(RUN_ARGS):;@:) | ||
|
||
env: | ||
cp -n make/${RUN_ARGS}/infrastructure/.env.dist .env | ||
|
||
down-clear: ## Down service and remove volumes. | ||
docker-compose down --remove-orphans -v | ||
rm -rf var vendor composer.lock docker-compose.yml | ||
|
||
.PHONY: help | ||
|
||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) | ||
|
||
.DEFAULT_GOAL := help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
date.timezone=Europe/Moscow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
xdebug.mode=${XDEBUG_MODE} | ||
xdebug.client_host=host.docker.internal | ||
xdebug.client_port=9003 | ||
xdebug.idekey=PHPSTORM | ||
xdebug.start_with_request=yes | ||
xdebug.log_level=3 | ||
xdebug.log="/tmp/xdebug.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# syntax=docker/dockerfile:experimental | ||
ARG php_cli_image | ||
FROM $php_cli_image AS php-common | ||
|
||
ARG pear_ext_dir_date | ||
ENV PHP_EXT_DIR "/usr/local/lib/php/extensions/no-debug-non-zts-$pear_ext_dir_date" | ||
RUN set -ex \ | ||
&& if [ `pear config-get ext_dir` != ${PHP_EXT_DIR} ]; then echo PHP_EXT_DIR must be `pear config-get ext_dir` && exit 1; fi | ||
|
||
FROM php-common AS php-build | ||
RUN --mount=type=cache,target=/var/cache/apk set -ex \ | ||
&& apk add --update-cache $PHPIZE_DEPS | ||
|
||
FROM php-build AS php-ext-intl | ||
RUN --mount=type=cache,target=/var/cache/apk set -ex \ | ||
&& apk add \ | ||
icu-dev \ | ||
&& docker-php-ext-install intl | ||
|
||
FROM php-build AS php-ext-xdebug | ||
RUN set -ex \ | ||
&& apk add --update linux-headers \ | ||
&& pecl install xdebug | ||
|
||
FROM php-build AS php-ext-pcntl | ||
RUN set -ex \ | ||
&& docker-php-ext-install pcntl | ||
|
||
FROM php-common AS php-base | ||
COPY --from=php-ext-intl ${PHP_EXT_DIR}/intl.so ${PHP_EXT_DIR}/ | ||
COPY --from=php-ext-intl /usr/local /usr/local | ||
COPY --from=php-ext-pcntl ${PHP_EXT_DIR}/pcntl.so ${PHP_EXT_DIR}/ | ||
COPY --from=php-ext-xdebug ${PHP_EXT_DIR}/xdebug.so ${PHP_EXT_DIR}/ | ||
RUN --mount=type=cache,target=/var/cache/apk \ | ||
set -ex \ | ||
&& apk add libpq icu shadow gettext git \ | ||
&& docker-php-ext-enable intl pcntl xdebug \ | ||
&& mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini | ||
|
||
COPY ./php-cli/conf.d /usr/local/etc/php/conf.d | ||
|
||
ARG user | ||
ARG uid | ||
|
||
RUN addgroup $user \ | ||
&& adduser -DS -h /home/$user -u 1000 -G $user $user \ | ||
&& adduser www-data $user \ | ||
&& mkdir -p /home/$user/.composer \ | ||
&& chown -R $user:$user /home/$user | ||
|
||
COPY --chown=$user:$user --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
USER $user:$user | ||
|
||
ARG app_dir | ||
WORKDIR $app_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
php-analyze: ## Run static analyze - phpcs, phplint, phpstan, psalm. | ||
docker-compose run --rm php-cli composer php-analyze | ||
|
||
php-cs-fix: | ||
docker-compose run --rm php-cli composer cs-fix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
composer-install: ## Install composer dependecies. | ||
docker-compose run --rm php-cli composer install --no-interaction --no-progress | ||
|
||
composer-normalize: | ||
docker-compose run --rm php-cli composer normalize | ||
|
||
composer-require: | ||
docker-compose run --rm php-cli composer req ${RUN_ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
docker-compose: | ||
envsubst < make/${APP_ENV}/infrastructure/docker-compose.yml > docker-compose.yml | ||
|
||
docker-build: ## Buid dev images | ||
docker-compose build | ||
|
||
docker-up: ## Start service. | ||
docker-compose up -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# app. | ||
APP_NAME=jwt-core | ||
APP_VERSION=0.3.1 | ||
APP_DIR=/app | ||
APP_ENV=dev | ||
APP_DEBUG=true | ||
APP_SECRET=11b2c9dfc2dbecf56941327b7c84cdf9 | ||
# php. | ||
PHP_VERSION=8.3.1 | ||
PHP_CLI_IMAGE=php:${PHP_VERSION}-cli-alpine | ||
XDEBUG_MODE=develop,debug,coverage | ||
# php 8.2.1 | ||
# PEAR_EXT_DIR_DATE=20220829 | ||
# php 8.3.1 | ||
PEAR_EXT_DIR_DATE=20230831 | ||
# docker. | ||
COMPOSE_DOCKER_CLI_BUILD=1 | ||
DOCKER_BUILDKIT=1 | ||
UID=1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "3.9" | ||
|
||
services: | ||
php-cli: | ||
build: | ||
context: ./docker | ||
dockerfile: php-cli/php-cli.dockerfile | ||
args: | ||
php_cli_image: ${PHP_CLI_IMAGE} | ||
app_dir: ${APP_DIR} | ||
user: ${USER} | ||
uid: ${UID} | ||
pear_ext_dir_date: ${PEAR_EXT_DIR_DATE} | ||
env_file: [ .env ] | ||
networks: [ backend ] | ||
dns: [ 8.8.4.4, 8.8.8.8 ] | ||
extra_hosts: [ "host.docker.internal:host-gateway" ] | ||
volumes: | ||
- .:${APP_DIR}:rw | ||
|
||
networks: | ||
backend: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
prepare: | ||
@make env dev | ||
@make docker-compose dev | ||
|
||
install: prepare docker-build docker-up composer-install ## Build & run app developments containers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
php-tests: ## Run phpunit tests. | ||
docker-compose run --rm php-cli composer php-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters