chore: docker cleanup/refactoring

This commit is contained in:
Brock H Caldwell
2025-11-04 12:55:19 -06:00
parent adb79db8f5
commit 7cc48ffc73
6 changed files with 43 additions and 52 deletions

View File

@@ -12,3 +12,4 @@ phpstan.dist.neon
phpunit.dist.xml
nomad.deploy.hcl
deployment.properties
var/download/*

View File

@@ -36,8 +36,6 @@ services:
build:
dockerfile: docker/Dockerfile.worker
context: .
args:
APP_VERSION: latest
restart: unless-stopped
volumes:
- $PWD:/app
@@ -45,14 +43,11 @@ services:
tty: true
environment:
TZ: America/Chicago
command: --download 2 --async
scheduler:
build:
dockerfile: docker/Dockerfile.worker
dockerfile: docker/Dockerfile.scheduler
context: .
args:
APP_VERSION: latest
restart: unless-stopped
volumes:
- $PWD:/app

View File

@@ -13,8 +13,6 @@ services:
- /mnt/media/downloads/tvshows:/var/download/tvshows
- mercure_data:/data
- mercure_config:/config
depends_on:
- database
worker:
@@ -22,36 +20,21 @@ services:
volumes:
- /mnt/media/downloads/movies:/var/download/movies
- /mnt/media/downloads/tvshows:/var/download/tvshows
restart: always
# command: -vv --time-limit=3600 --limit=10
deploy:
replicas: 2
depends_on:
- app
#
# scheduler:
# image: registry.caldwell.digital/home/torsearch-scheduler:${TAG}
# volumes:
# - /mnt/media/downloads/movies:/var/download/movies
# - /mnt/media/downloads/tvshows:/var/download/tvshows
# restart: always
# command: -vv
# depends_on:
# - app
redis:
image: redis:latest
scheduler:
image: registry.caldwell.digital/home/torsearch-scheduler:${TAG}
volumes:
- redis_data:/data
command: redis-server --maxmemory 512MB
restart: unless-stopped
- /mnt/media/downloads/movies:/var/download/movies
- /mnt/media/downloads/tvshows:/var/download/tvshows
depends_on:
- app
volumes:
mysql:
mercure_config:
mercure_data:
redis_data:

View File

@@ -27,3 +27,9 @@ RUN mkdir -p /etc/supervisor/conf.d
# We start supervisord and supervisord starts
# respective service in the configuration file.
ENTRYPOINT ["/app/bin/console", "init:worker"]
# Message transports can be enabled by passing them as command options.
# Inlcluding a number with the option will start that amount of processes
# for the transport. Not supplying a number will default to 1.
# --download --monitor OR --download 2 --monitor

View File

@@ -1,10 +1,21 @@
FROM code.caldwell.digital/home/torsearch-base-worker:php8.4-alpine
###
# This version of Torsearch can run the scheduler, downloader, and
# worker in one container. Each process is managerd by supervisord
# and can be configured via environment variables, and more than
# one of these containers can still be run.
###
ARG APP_VERSION="0.0.0-dev"
ENV APP_VERSION="${APP_VERSION}"
# Default to latest, but should pass in a version
ARG APP_VERSION="latest"
COPY . /app
# Start with our base worker image
FROM code.caldwell.digital/home/torsearch-base-worker-supervisord:latest
ENTRYPOINT [ "php", "/app/bin/console", "messenger:consume", "scheduler_monitor" ]
# Set the APP_VERSION in the image
ENV APP_VERSION=${APP_VERSION}
HEALTHCHECK --interval=3s --timeout=3s --retries=10 CMD return 0
# Copy the actual application code from the previously built app
COPY --chown=1000:1000 ./ /app
# To retain backwards compatibility, default to async & download transports
CMD [ "--async", "--download" ]

View File

@@ -1,26 +1,21 @@
###
# This version of Torsearch runs the scheduler, downloader, and worker
# in this one container. Each process is managerd by supervisord
# and can be configured via environment variables and more
# than one of these containers cans till be run.
# This version of Torsearch can run the scheduler, downloader, and
# worker in one container. Each process is managerd by supervisord
# and can be configured via environment variables, and more than
# one of these containers can still be run.
###
# Default to latest, but should pass in a version
ARG APP_VERSION="latest"
FROM code.caldwell.digital/home/torsearch-app:${APP_VERSION} AS base_image
# Start with our base worker image
FROM code.caldwell.digital/home/torsearch-base-worker-supervisord:latest
# Set the APP_VERSION in the image
ENV APP_VERSION=${APP_VERSION}
COPY --from=base_image --chown=1000:1000 /app /app
COPY docker/ /app/docker
# Copy the actual application code from the previously built app
COPY --chown=1000:1000 ./ /app
# We start supervisord and supervisord starts
# respective service in the configuration file.
ENTRYPOINT ["/app/bin/console", "init:worker"]
# Message transports can be enabled by passing them as command options.
# Inlcluding a number with the option will start that amount of processes
# for the transport. Not supplying a number will default to 1.
# --download --monitor OR --download 2 --monitor
# To retain backwards compatibility, default to async & download transports
CMD [ "--async", "--download" ]