diff --git a/docker/api/.env b/.docker-compose/api/.env similarity index 100% rename from docker/api/.env rename to .docker-compose/api/.env diff --git a/docker/api/log.conf b/.docker-compose/api/log.conf similarity index 100% rename from docker/api/log.conf rename to .docker-compose/api/log.conf diff --git a/docker/nginx/cojedzie.conf b/.docker-compose/nginx/cojedzie.conf similarity index 100% rename from docker/nginx/cojedzie.conf rename to .docker-compose/nginx/cojedzie.conf diff --git a/docker/api/fpm.Dockerfile b/build/api/fpm.Dockerfile similarity index 100% rename from docker/api/fpm.Dockerfile rename to build/api/fpm.Dockerfile diff --git a/docker/api/rr.Dockerfile b/build/api/rr.Dockerfile similarity index 100% rename from docker/api/rr.Dockerfile rename to build/api/rr.Dockerfile diff --git a/build/standalone/rr.Dockerfile b/build/standalone/rr.Dockerfile new file mode 100644 index 0000000..d68903e --- /dev/null +++ b/build/standalone/rr.Dockerfile @@ -0,0 +1,31 @@ +ARG COJEDZIE_VER=latest + +FROM cojedzie/api:${COJEDZIE_VER}-rr + +RUN apk add supervisor && \ + { \ + echo '[supervisord]'; \ + echo 'nodaemon=true'; \ + echo ; \ + echo '[program:roadrunner]'; \ + echo 'command=rr serve'; \ + echo 'startsecs=0'; \ + echo 'start=true'; \ + echo 'autorestart=true'; \ + echo 'stdout_logfile=/dev/stdout'; \ + echo 'stderr_logfile=/dev/stderr'; \ + echo 'stdout_logfile_maxbytes=0'; \ + echo 'stderr_logfile_maxbytes=0'; \ + echo ; \ + echo '[program:messenger-consumer]'; \ + echo 'command=php /var/www/bin/console messenger:consume main -vv --time-limit=86400 --limit=10'; \ + echo 'startsecs=0'; \ + echo 'start=true'; \ + echo 'autorestart=true'; \ + echo 'stdout_logfile=/dev/stdout'; \ + echo 'stderr_logfile=/dev/stderr'; \ + echo 'stdout_logfile_maxbytes=0'; \ + echo 'stderr_logfile_maxbytes=0'; \ + } | tee /etc/supervisord.conf; + +CMD ["./bin/docker-init.sh", "supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker/worker/Dockerfile b/build/worker/Dockerfile similarity index 100% rename from docker/worker/Dockerfile rename to build/worker/Dockerfile index 058edf9..76d78b5 100644 --- a/docker/worker/Dockerfile +++ b/build/worker/Dockerfile @@ -5,22 +5,6 @@ LABEL maintainer="Kacper Donat " COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -RUN apk add supervisor && \ - { \ - echo '[supervisord]'; \ - echo 'nodaemon=true'; \ - echo ; \ - echo '[program:messenger-consumer]'; \ - echo 'command=php /var/www/bin/console messenger:consume main -vv --time-limit=86400 --limit=10'; \ - echo 'startsecs=0'; \ - echo 'start=true'; \ - echo 'autorestart=true'; \ - echo 'stdout_logfile=/dev/stdout'; \ - echo 'stderr_logfile=/dev/stderr'; \ - echo 'stdout_logfile_maxbytes=0'; \ - echo 'stderr_logfile_maxbytes=0'; \ - } | tee /etc/supervisord.conf; - WORKDIR /var/www RUN install-php-extensions bcmath intl opcache zip sockets; @@ -42,4 +26,20 @@ ENV PATH=$PATH:/var/www/bin RUN composer run-script post-install-cmd +RUN apk add supervisor && \ + { \ + echo '[supervisord]'; \ + echo 'nodaemon=true'; \ + echo ; \ + echo '[program:messenger-consumer]'; \ + echo 'command=php /var/www/bin/console messenger:consume main -vv --time-limit=86400 --limit=10'; \ + echo 'startsecs=0'; \ + echo 'start=true'; \ + echo 'autorestart=true'; \ + echo 'stdout_logfile=/dev/stdout'; \ + echo 'stderr_logfile=/dev/stderr'; \ + echo 'stdout_logfile_maxbytes=0'; \ + echo 'stderr_logfile_maxbytes=0'; \ + } | tee /etc/supervisord.conf; + CMD ["supervisord", "-c", "/etc/supervisord.conf"] diff --git a/docker-compose.yml b/docker-compose.yml index f16cebd..6eec0da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,17 +8,17 @@ services: volumes: - ./front:/var/www/front:cached - ./api:/var/www/api:cached - - ./docker/nginx/cojedzie.conf:/etc/nginx/conf.d/cojedzie.conf + - .docker-compose/nginx/cojedzie.conf:/etc/nginx/conf.d/cojedzie.conf api: build: context: ./api dockerfile: Dockerfile env_file: - - ./docker/api/.env + - .docker-compose/api/.env volumes: - ./api:/var/www:cached - - ./docker/api/log.conf:/usr/local/etc/php-fpm.d/zz-log.conf + - .docker-compose/api/log.conf:/usr/local/etc/php-fpm.d/zz-log.conf frontend: image: node:15.2.1 diff --git a/docker/worker/supervisord.conf b/docker/worker/supervisord.conf deleted file mode 100644 index 54296b8..0000000 --- a/docker/worker/supervisord.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=true