Skip to content

Commit

Permalink
Improvements:
Browse files Browse the repository at this point in the history
- Subsidiary containers such as queue and cron are now boot based on the app container
- App container no longer uses supervisor to manage its processes. Commands are passed from docker-compose
- Added configs for an optional websocket container in php7.4 and 8.x
  • Loading branch information
coolsam726 committed Aug 20, 2021
1 parent 11687ff commit 1646d7e
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docker/octane/.docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM spiralscout/roadrunner:2.1.1 as rr
FROM php:8-fpm-alpine
FROM php:8-fpm-alpine:3.13

LABEL maintainer="Sam Maosa <maosa.sam@gmail.com>"

Expand Down
6 changes: 3 additions & 3 deletions docker/php7.4/.docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-fpm-alpine
FROM php:7.4-fpm-alpine3.13

LABEL maintainer="Sam Maosa <maosa.sam@gmail.com>"

Expand Down Expand Up @@ -105,7 +105,7 @@ RUN adduser -S -D -G www-data -u $UID -h /home/$USER $USER
RUN mkdir -p /home/$USER/.composer && \
chown -R $USER:www-data /home/$USER
RUN chown -R $USER:www-data /app

EXPOSE 6001
ENTRYPOINT ["/entrypoint.sh"]

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
CMD ["php-fpm", "-F"]
60 changes: 47 additions & 13 deletions docker/php7.4/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ services:
app:
build:
context: ./
network: host
dockerfile: ./.docker/Dockerfile
args:
UID: ${DOCKER_UID}
USER: ${DOCKER_HOST_USER}
image: ${DOCKER_IMAGE_NAME}
environment:
ENABLE_CRON_JOB: ${DOCKER_ENABLE_CRON_JOB}
ENABLE_LARAVEL_WORKER: ${DOCKER_ENABLE_LARAVEL_WORKER}
ENABLE_LARAVEL_HORIZON: ${DOCKER_ENABLE_LARAVEL_HORIZON}
ENABLE_LARAVEL_WEBSOCKETS: ${DOCKER_ENABLE_LARAVEL_WEBSOCKETS}
container_name: ${DOCKER_IMAGE_NAME}-app
restart: unless-stopped
command: php-fpm -F
working_dir: /app
extra_hosts:
- "thishost:172.17.0.1"
depends_on:
- db
- redis
Expand All @@ -24,6 +23,34 @@ services:
- ./:/app:delegated
networks:
- default
queue:
image: ${DOCKER_IMAGE_NAME}
container_name: ${DOCKER_IMAGE_NAME}-queue
depends_on:
- app
restart: unless-stopped
working_dir: /app
command: php artisan queue:work
extra_hosts:
- "thishost:172.17.0.1"
volumes:
- ./:/app:delegated
networks:
- default
cron:
image: ${DOCKER_IMAGE_NAME}
container_name: ${DOCKER_IMAGE_NAME}-cron
depends_on:
- app
restart: unless-stopped
extra_hosts:
- "thishost:172.17.0.1"
working_dir: /app
command: crond -f
volumes:
- ./:/app:delegated
networks:
- default
server:
image: nginx:alpine
container_name: ${DOCKER_IMAGE_NAME}-server
Expand Down Expand Up @@ -66,14 +93,21 @@ services:
- redis-data:/var/lib/redis
networks:
- default
mailhog:
image: "mailhog/mailhog"
container_name: ${DOCKER_IMAGE_NAME}-mailhog
restart: unless-stopped
ports:
- ${DOCKER_MAILHOG_WEB_PORT}:8025
networks:
- default
# websockets:
# image: ${DOCKER_IMAGE_NAME}
# container_name: ${DOCKER_IMAGE_NAME}-websockets
# restart: unless-stopped
# depends_on:
# - app
# volumes:
# - ./:/app:delegated
# command: php artisan websockets:serve
# expose:
# - "6001"
# ports:
# - "${DOCKER_WEBSOCKETS_EXPOSED_PORT}:6001"
# networks:
# - default
volumes:
db-data:
external:
Expand Down
6 changes: 3 additions & 3 deletions docker/php8.x/.docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.0-fpm-alpine
FROM php:8.0-fpm-alpine3.13

LABEL maintainer="Sam Maosa <maosa.sam@gmail.com>"

Expand Down Expand Up @@ -104,7 +104,7 @@ RUN adduser -S -D -G www-data -u $UID -h /home/$USER $USER
RUN mkdir -p /home/$USER/.composer && \
chown -R $USER:www-data /home/$USER
RUN chown -R $USER:www-data /app

EXPOSE 6001
ENTRYPOINT ["/entrypoint.sh"]

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
CMD ["php-fpm", "-F"]
60 changes: 47 additions & 13 deletions docker/php8.x/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ services:
app:
build:
context: ./
network: host
dockerfile: ./.docker/Dockerfile
args:
UID: ${DOCKER_UID}
USER: ${DOCKER_HOST_USER}
image: ${DOCKER_IMAGE_NAME}
environment:
ENABLE_CRON_JOB: ${DOCKER_ENABLE_CRON_JOB}
ENABLE_LARAVEL_WORKER: ${DOCKER_ENABLE_LARAVEL_WORKER}
ENABLE_LARAVEL_HORIZON: ${DOCKER_ENABLE_LARAVEL_HORIZON}
ENABLE_LARAVEL_WEBSOCKETS: ${DOCKER_ENABLE_LARAVEL_WEBSOCKETS}
container_name: ${DOCKER_IMAGE_NAME}-app
restart: unless-stopped
command: php-fpm -F
working_dir: /app
extra_hosts:
- "thishost:172.17.0.1"
depends_on:
- db
- redis
Expand All @@ -24,6 +23,34 @@ services:
- ./:/app:delegated
networks:
- default
queue:
image: ${DOCKER_IMAGE_NAME}
container_name: ${DOCKER_IMAGE_NAME}-queue
depends_on:
- app
restart: unless-stopped
working_dir: /app
command: php artisan queue:work
extra_hosts:
- "thishost:172.17.0.1"
volumes:
- ./:/app:delegated
networks:
- default
cron:
image: ${DOCKER_IMAGE_NAME}
container_name: ${DOCKER_IMAGE_NAME}-cron
depends_on:
- app
restart: unless-stopped
extra_hosts:
- "thishost:172.17.0.1"
working_dir: /app
command: crond -f
volumes:
- ./:/app:delegated
networks:
- default
server:
image: nginx:alpine
container_name: ${DOCKER_IMAGE_NAME}-server
Expand Down Expand Up @@ -66,14 +93,21 @@ services:
- redis-data:/var/lib/redis
networks:
- default
mailhog:
image: "mailhog/mailhog"
container_name: ${DOCKER_IMAGE_NAME}-mailhog
restart: unless-stopped
ports:
- ${DOCKER_MAILHOG_WEB_PORT}:8025
networks:
- default
# websockets:
# image: ${DOCKER_IMAGE_NAME}
# container_name: ${DOCKER_IMAGE_NAME}-websockets
# restart: unless-stopped
# depends_on:
# - app
# volumes:
# - ./:/app:delegated
# command: php artisan websockets:serve
# expose:
# - "6001"
# ports:
# - "${DOCKER_WEBSOCKETS_EXPOSED_PORT}:6001"
# networks:
# - default
volumes:
db-data:
external:
Expand Down

0 comments on commit 1646d7e

Please sign in to comment.