From 26c9d4ecf29779268797a2c8152e84a68abdfa24 Mon Sep 17 00:00:00 2001 From: Ilyes512 Date: Sat, 30 Dec 2023 15:12:18 +0100 Subject: [PATCH] Realigned package with package skeleton --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 6 ++- .env | 4 +- .gitattributes | 4 +- .gitignore | 2 - LICENSE | 22 ++------- Taskfile.dev.yml | 77 ------------------------------- Taskfile.dist.yml | 73 +++++++++++++++++++++++++++++ docker-compose.yml => compose.yml | 7 ++- 9 files changed, 89 insertions(+), 108 deletions(-) delete mode 100644 Taskfile.dev.yml create mode 100644 Taskfile.dist.yml rename docker-compose.yml => compose.yml (97%) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b022c82..ac0c389 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,7 +8,7 @@ ARG USER_GID=$USER_UID ARG WORKSPACE_PATH=/workspace RUN groupadd --gid "$USER_GID" "$USERNAME" \ - && useradd --uid "$USER_UID" --gid "$USER_GID" --create-home "$USERNAME" \ + && useradd --uid "$USER_UID" --gid "$USER_GID" --create-home "$USERNAME" --shell /bin/bash \ && mkdir -p \ "$WORKSPACE_PATH" \ "/home/$USERNAME/.vscode-server/extensions" \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 876e85e..a40d460 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ { "name": "code-style", "remoteUser": "code", - "dockerComposeFile": ["../docker-compose.yml"], + "dockerComposeFile": ["../compose.yml"], "service": "php", "workspaceFolder": "/workspace", "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", @@ -18,5 +18,9 @@ "mhutchie.git-graph" ] } + }, + "features": { + "ghcr.io/devcontainers-contrib/features/go-task:1": {}, + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} } } diff --git a/.env b/.env index bc0cc47..d7dd09f 100644 --- a/.env +++ b/.env @@ -3,5 +3,5 @@ COMPOSE_PROJECT_NAME=code-style REGISTRY_HOST=ghcr.io REGISTRY_PATH=ilyes512 -IMAGE_REGISTRY_PHP=${REGISTRY_HOST}/${REGISTRY_PATH}/php82-fpm -IMAGE_TAG_PHP_VSCODE=vscode-1.0.3 +IMAGE_REGISTRY_PHP=${REGISTRY_HOST}/${REGISTRY_PATH}/php83-fpm +IMAGE_TAG_PHP_VSCODE=vscode-1.0.0 diff --git a/.gitattributes b/.gitattributes index ec0eae3..6b61ce3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,8 +15,6 @@ /ecs-local.php export-ignore /phpstan.neon export-igore /phpstan.dist.neon export-ignore -/phpunit.xml export-ignore -/phpunit.xml.dist export-ignore /Taskfile.dist.yml export-ignore /Taskfile.yml export-ignore -/docker-compose.yml export-ignore +/compose.yml export-ignore diff --git a/.gitignore b/.gitignore index f5b7b0b..ff98b62 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,6 @@ /composer.lock /vendor /phpstan.neon -/phpunit.xml -/.phpunit-cache /.phplint.cache /auth.json Taskfile.yml diff --git a/LICENSE b/LICENSE index 862ba34..9fae3ce 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,7 @@ -MIT License +Copyright 2023 Ilyes Ahidar -Copyright (c) 2023 Ilyes512 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Taskfile.dev.yml b/Taskfile.dev.yml deleted file mode 100644 index e5e04c1..0000000 --- a/Taskfile.dev.yml +++ /dev/null @@ -1,77 +0,0 @@ -version: "3" - -dotenv: ['.env'] - -silent: true - -######################################################################################################################## -# -# TOC -# -######################################################################################################################## -# -# 1. COMPOSER -# 2. MISCELLANEOUS -# -######################################################################################################################## - -tasks: - ###################################################################################################################### - # - # 1. COMPOSER - # - ###################################################################################################################### - - c:update: - desc: Run composer update - cmds: - - task: c:exec - vars: - SUBCMD: update - - c:install: - desc: Run composer install - cmds: - - task: c:exec - vars: - SUBCMD: install - - c:exec: - preconditions: - - sh: test '{{.SUBCMD}}' = 'install' -o '{{.SUBCMD}}' = 'update' - msg: SUBCMD value needs to be either 'install' or 'update' - cmds: - - docker volume create php_composer_cache - - docker run - --interactive - --tty - --rm - --volume "$(pwd)":/var/www - --volume php_composer_cache:/home/composer/.composer - --entrypoint '' - -e COMPOSER_HOME=/home/composer/.composer - $IMAGE_REPO_PHP:$IMAGE_TAG_PHP_BUILDER - composer {{.SUBCMD}} - --no-progress - --prefer-dist - --ignore-platform-reqs - - ###################################################################################################################### - # - # 2. MISCELLANEOUS - # - ###################################################################################################################### - - dc:down: - desc: Cleanup Devcontainer including volumes - cmds: - - docker-compose down --volumes - - cleanup: - desc: Cleanup generated files and vendor files - cmds: - - rm -rf - vendor - composer.lock - .phplint.cache - && printf "%s\n" "Successfully removed vendor/generated files..." diff --git a/Taskfile.dist.yml b/Taskfile.dist.yml new file mode 100644 index 0000000..57b3e1c --- /dev/null +++ b/Taskfile.dist.yml @@ -0,0 +1,73 @@ +version: "3" + +dotenv: ['.env'] + +silent: true + +tasks: + + c:update: + desc: Run composer update + cmds: + - task: c:exec + vars: { SUBCMD: update } + + c:install: + desc: Run composer install + cmds: + - task: c:exec + vars: { SUBCMD: install } + + c:exec: + desc: Run composer update or install + internal: true + preconditions: + - sh: test '{{.SUBCMD}}' = 'install' -o '{{.SUBCMD}}' = 'update' + msg: SUBCMD value needs to be either 'install' or 'update' + cmds: + - docker volume create php_composer_cache + - docker run + --interactive + --tty + --rm + --volume "$(pwd)":/var/www + --volume php_composer_cache:/home/composer/.composer + --entrypoint '' + -e COMPOSER_HOME=/home/composer/.composer + $IMAGE_REPO_PHP:$IMAGE_TAG_PHP_BUILDER + composer {{.SUBCMD}} + --no-progress + --prefer-dist + --ignore-platform-reqs + + stop: + desc: Stop Devcontainer + cmds: + - docker compose stop + + down: + desc: Cleanup Devcontainer including volumes + cmds: + - docker compose down --volumes + + cleanup: + desc: Cleanup of almost all gitignored files and untracked files + prompt: This could potentially delete untracked files!! Do you want to continue? + summary: | + Cleanup of almost all gitignored files, untracked files and development containers. + + The following files/dirs are excluded: + - /.idea + - /.vscode + cmds: + - git clean + -xd + --force + --exclude .idea + --exclude .vscode + + cleanup:all: + desc: Cleanup of almost all gitignored files, untracked files and removal of development containers + cmds: + - task: down + - task: cleanup diff --git a/docker-compose.yml b/compose.yml similarity index 97% rename from docker-compose.yml rename to compose.yml index 31e1118..05f8465 100644 --- a/docker-compose.yml +++ b/compose.yml @@ -1,4 +1,6 @@ -version: "3.7" +volumes: + vscode-extensions: + services: php: image: ${COMPOSE_PROJECT_NAME}-php-vscode:latest @@ -14,6 +16,3 @@ services: # - $HOME/auth.json:/root/auth.json:ro - .:/workspace:delegated - vscode-extensions:/home/code/.vscode-server/extensions - -volumes: - vscode-extensions: