forked from vend/php-resque
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from MauBoy/php-8.1-update
PHP Upgrade, docker- and makefile
- Loading branch information
Showing
14 changed files
with
663 additions
and
563 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 |
---|---|---|
|
@@ -3,3 +3,5 @@ vendor/ | |
composer.phar | ||
.idea/ | ||
build.properties | ||
.phpunit.result.cache | ||
dump.rdb |
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,22 @@ | ||
FROM redis:7.0.7-bullseye | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Set work directory | ||
WORKDIR /app | ||
|
||
# Add sury php | ||
RUN apt update | ||
RUN apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 curl | ||
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list | ||
RUN curl -fsSL https://packages.sury.org/php/apt.gpg| gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg | ||
|
||
# Install php | ||
RUN apt update | ||
RUN apt install php8.1 php8.1-dom php8.1-mbstring php8.1-curl -y | ||
|
||
# Install tools | ||
RUN apt install zip unzip php-zip -y | ||
|
||
# Install composer and dependencies | ||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
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,67 @@ | ||
# Variables and flags | ||
MAKEFLAGS += --silent | ||
DOCKER_COMPOSE = docker-compose --file docker-compose.yml | ||
WORK_DIRECTORY = app | ||
|
||
# Right and OS management | ||
UID := $(shell id -u) | ||
GID := $(shell id -g) | ||
OS := $(shell uname) | ||
|
||
# Do not remove - it filters empty arguments from command line | ||
%: | ||
@: | ||
|
||
# Help | ||
help: | ||
@echo "Usage:" | ||
@echo " make <COMMAND>" | ||
@echo "" | ||
|
||
@echo " Docker commands:" | ||
@echo " ----------------------------------------------------------------------------------------" | ||
|
||
@echo " start Start all docker container" | ||
@echo " stop Stop all docker container" | ||
@echo " restart Restart all docker container" | ||
@echo " down Destroy all docker container" | ||
@echo " exec Connect directly to docker container" | ||
|
||
@echo " ----------------------------------------------------------------------------------------" | ||
@echo "" | ||
|
||
@echo " Test commands:" | ||
@echo " ----------------------------------------------------------------------------------------" | ||
@echo " phpunit, pu Run php unit tests" | ||
@echo " ----------------------------------------------------------------------------------------" | ||
@echo "" | ||
|
||
# Docker | ||
start: | ||
@echo "--- Starting docker container ---" | ||
rm -rf dump.rdb | ||
${DOCKER_COMPOSE} up --build -d | ||
${DOCKER_COMPOSE} exec app bash -c "composer install" | ||
@echo "--- Started docker container ---" | ||
|
||
stop: | ||
@echo "--- Stopping docker container ---" | ||
${DOCKER_COMPOSE} stop -t1 | ||
@echo "--- Stopped docker container ---" | ||
|
||
restart: stop start | ||
|
||
down: | ||
@echo "--- Destroying docker container ---" | ||
${DOCKER_COMPOSE} down -v | ||
@echo "--- Finished destroying docker container ---" | ||
|
||
exec: | ||
@echo "--- Connecting to ${WORK_DIRECTORY} container ---" | ||
${DOCKER_COMPOSE} exec ${WORK_DIRECTORY} bash | ||
|
||
# Tests | ||
phpunit pu: | ||
@echo "--- Running php unit tests ---" | ||
${DOCKER_COMPOSE} exec app ./vendor/bin/phpunit | ||
@echo "--- Finished running php unit 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
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
Oops, something went wrong.