Open darakanoit opened 2 years ago
+1
I have something like this
version: '3.9'
services:
php-prepare:
build:
context: ${PWD}/php
image: spiral-php
pull_policy: never
user: "1000:1000"
volumes:
- src_data:/var/www/html
entrypoint:
- bash
- -c
command:
- "composer install && if [ ! -f rr ]; then composer run-script post-create-project-cmd; fi"
php:
restart: on-failure
image: spiral-php
pull_policy: never
user: "1000:1000"
volumes:
- php_conf:/usr/local/etc/php/z_custom
- src_data:/var/www/html
ports:
- "8080:8080"
env_file:
- src/.env
environment:
PHP_INI_SCAN_DIR: :/usr/local/etc/php/z_custom
PHP_IDE_CONFIG: serverName=spiral.local
networks:
default:
depends_on:
php-prepare:
condition: service_completed_successfully
rabbitmq:
condition: service_started
mailhog:
condition: service_started
rabbitmq:
restart: on-failure
image: rabbitmq:management-alpine
hostname: rabbitmq
env_file:
- src/.env
ports:
- "15672:15672"
mailhog:
restart: on-failure
image: mailhog/mailhog
ports:
- "8025:8025"
volumes:
src_data:
driver: local
driver_opts:
type: none
device: ${PWD}/src
o: bind
php_conf:
driver: local
driver_opts:
type: none
device: ${PWD}/php/conf.d
o: bind
networks:
default:
And Dockerfile in ./php like this
FROM php:8.2-cli-bullseye
RUN set -xe \
&& apt-get update \
&& apt-get -y --no-install-recommends install \
unzip \
&& docker-php-ext-install \
opcache \
sockets \
&& pecl install \
xdebug \
&& docker-php-ext-enable \
opcache \
sockets \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/bin --filename=composer --version=2.5.4 \
&& php -r "unlink('composer-setup.php');" \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
EXPOSE 8080
CMD ["./rr", "serve"]
Is there any progress? It would be great if the installer gave docker-compose at the output.
Add docker-compose to the repositories to quickly raise the project as in keeper