From 0553a067b82bbcb096ed48ea663b9ff6903241c0 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 25 Jan 2021 11:09:27 +0100 Subject: [PATCH] fix logrotate --- docker-compose.yml | 2 +- docker/nginx/Dockerfile | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index cfeccaa4..e5ed172b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,12 +64,12 @@ services: container_name: nginx restart: unless-stopped logging: *default-logging + user: env_file: - .env volumes: - ./docker/nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro - ./docker/nginx/conf.d:/etc/nginx/conf.d:ro - - ./docker/nginx/logrotate:/etc/logrotate.d/nginx:ro - ./docker/data/nginx/cache:/data/nginx/cache - ./docker/data/nginx/logs:/usr/local/openresty/nginx/logs - ./docker/data/nginx/skynet:/data/nginx/skynet:ro diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index f5f33c7b..76ad4d74 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -6,4 +6,8 @@ RUN luarocks install luasocket # change "syslog" user to "adm" user in logrotate.conf RUN sed -i 's/^su root syslog/su root adm/' /etc/logrotate.conf +# copy nginx logrotate config and assign correct owner +COPY ./logrotate /etc/logrotate.d/nginx +RUN chown root:root /etc/logrotate.d/nginx + CMD ["sh", "-c", "service cron start ; /usr/local/openresty/bin/openresty -g 'daemon off;'"]