Add container for running tasks

2022-03-24
Luca 3 years ago
parent d84a336310
commit ba2cc09dc0

@ -1,5 +1,6 @@
# Docker config # Docker config
docker/ docker/
!docker/crontab
!docker/nginx/entrypoint.sh !docker/nginx/entrypoint.sh
!docker/nginx/nginx.conf !docker/nginx/nginx.conf

@ -27,6 +27,31 @@ COPY --from=composer /app/composer.lock /app/
RUN find /app/storage/ -type f -not -name VERSION -exec rm {} \; RUN find /app/storage/ -type f -not -name VERSION -exec rm {} \;
# Fetch supercronic
FROM alpine as supercronic
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.12/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=048b95b48b708983effb2e5c935a1ef8483d9e3e
RUN apk add --no-cache curl \
&& curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}"
# Build a container for running tasks
FROM php:8-cli-alpine as cron
RUN apk add --no-cache icu-dev && \
docker-php-ext-install intl pdo_mysql
COPY --from=data /app/ /app
COPY --from=supercronic /usr/local/bin/supercronic-linux-amd64 /usr/local/bin/supercronic
COPY docker/crontab /etc/crontab
ENTRYPOINT ["/usr/local/bin/supercronic"]
# Build the PHP container # Build the PHP container
FROM php:8-fpm-alpine FROM php:8-fpm-alpine
WORKDIR /var/www WORKDIR /var/www

@ -0,0 +1,2 @@
# Run schedule import every minute
*/1 * * * * /app/bin/import '*'
Loading…
Cancel
Save