ofelia
ofelia copied to clipboard
Problem with entry-point or command
I have a simple docker image which extends php:8.2-cli-alpine.
When I try to set up cron which have to run php artisan sync:api, it looks like ofelia tries to run container with default entry-point (in this case php) and then only to run php artisan sync:api
Is there any chance to rewrite this behavior?
Logs
2023-10-18T12:02:01.659Z common.go:125 ▶ NOTICE [Job "sync-cron" (838f100054df)] StdOut: Interactive shell
php-cli |
php-cli | php >
Dockerfile
FROM php:8.2-cli-alpine
RUN apk add --no-cache bash
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN install-php-extensions pdo_mysql
WORKDIR /app
docker-compose.yml
version: "3.8"
services:
php-cli:
build:
dockerfile: .docker/Dockerfile
container_name: php-cli
restart: no
env_file: .env
environment:
- "DB_HOST=..."
user: "1000:1000"
volumes:
- ./:/app
networks:
- test-network
cron:
container_name: cron
image: mcuadros/ofelia:latest
command: daemon --docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- test-network
labels:
ofelia.enabled: "true"
ofelia.job-run.sync-cron.schedule: "0 00 12 * * *"
ofelia.job-run.sync-cron.command: "php artisan sync:api"
ofelia.job-run.sync-cron.container: "php-cli"
networks:
test-network:
name: "test-network"
driver: bridge