From f320a4afba32d87fe6dd82e0339d6508da83a421 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sat, 3 Aug 2024 23:35:34 +0700 Subject: [PATCH] #37 feat: config docker for worker --- docker-compose.yml | 14 ++++++++++++++ worker/Dockerfile | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 worker/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 7ba7630..f0a495e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -151,3 +151,17 @@ services: interval: 30s timeout: 10s retries: 5 + + worker: + container_name: "${COMPOSE_PROJECT_NAME}-worker" + build: + context: worker + args: + - TZ=${TZ} + - USER_ID=${USER_ID} + - GROUP_ID=${GROUP_ID} + networks: + - cslant_blog + volumes: + - ${SOURCE_CODE_PATH}:/var/dev + - ./worker/supervisor.d:/etc/supervisor.d diff --git a/worker/Dockerfile b/worker/Dockerfile new file mode 100644 index 0000000..41bc3fe --- /dev/null +++ b/worker/Dockerfile @@ -0,0 +1,26 @@ +FROM php:8.3-cli-alpine + +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" + +ARG USER_ID=1000 +ENV USER_ID ${USER_ID} +ARG GROUP_ID=1000 +ENV GROUP_ID ${GROUP_ID} + +RUN set -eu; \ + addgroup -g ${USER_ID} csdev; \ + adduser -D -u ${USER_ID} -G csdev csdev + +ADD blog.php.ini "$PHP_INI_DIR/conf.d/blog.ini" + +WORKDIR /var/dev + +ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN install-php-extensions soap pcntl bcmath gd exif sockets zip xdebug redis intl pdo_pgsql pgsql mysqli + +## Install supervisord +RUN apk add --no-cache supervisor + +ADD supervisord.conf /etc/supervisord.conf + +CMD ["supervisord", "-c", "/etc/supervisord.conf", "-n"]