generated from yiisoft/package-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added build an image from a docker-compose file
Co-authored-by: Dmitriy Derepko <xepozz@list.ru>
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 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
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 @@ | ||
help: ## Display help information | ||
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | ||
|
||
build: ## Build an image from a docker-compose file. Params: {{ v=8.1 }}. Default latest PHP 8.1 | ||
PHP_VERSION=$(filter-out $@,$(v)) docker-compose up -d --build | ||
|
||
down: ## Stop and remove containers, networks | ||
docker-compose down | ||
|
||
start: ## Start services | ||
docker-compose up -d | ||
|
||
sh: ## Enter the container with the application | ||
docker exec -it yii-runner-roadrunner sh | ||
|
||
test: ## Run tests. Params: {{ v=8.1 }}. Default latest PHP 8.1 | ||
PHP_VERSION=$(filter-out $@,$(v)) docker-compose build --pull yii-runner-roadrunner | ||
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii-runner-roadrunner vendor/bin/phpunit --colors=always -v --debug | ||
make down |
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,13 @@ | ||
version: '3.8' | ||
|
||
services: | ||
yii-runner-roadrunner: | ||
container_name: yii-runner-roadrunner | ||
hostname: yii-runner-roadrunner | ||
build: | ||
context: . | ||
dockerfile: tests/Docker/Dockerfile | ||
args: | ||
PHP_VERSION: ${PHP_VERSION:-8.1} | ||
volumes: | ||
- .:/app |
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,29 @@ | ||
# Important! Do not use this image in production! | ||
|
||
ARG PHP_VERSION | ||
FROM --platform=linux/amd64 php:${PHP_VERSION}-cli-alpine | ||
|
||
# Install main package | ||
RUN apk add git libzip-dev autoconf g++ make linux-headers | ||
|
||
# Install PHP extensions | ||
RUN docker-php-ext-install zip sockets | ||
|
||
# Install PHP extensions from PECL | ||
RUN pecl install xdebug pcov \ | ||
&& docker-php-ext-enable xdebug pcov | ||
|
||
# Install Composer | ||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
|
||
# Install RoadRunner | ||
COPY --from=spiralscout/roadrunner:2023.1.4 /usr/bin/rr /usr/local/bin/rr | ||
|
||
# Set up work directory | ||
ADD . /app | ||
WORKDIR /app | ||
|
||
RUN composer install --prefer-dist --no-interaction | ||
|
||
CMD ["sleep", "infinity"] |