-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Squtis1/master
Adding logrotate
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
FROM nginx:1.12-alpine | ||
FROM nginx:1.24.0-alpine | ||
|
||
RUN apk --no-cache add openssl | ||
|
||
# Add logrotate | ||
RUN apk --no-cache add logrotate | ||
|
||
# Download and install consul-template | ||
RUN wget -O /home/consul-template.zip \ | ||
https://releases.hashicorp.com/consul-template/0.16.0/consul-template_0.16.0_linux_386.zip && \ | ||
unzip /home/consul-template.zip -d /usr/bin && \ | ||
chmod +x /usr/bin/consul-template && \ | ||
rm /home/consul-template.zip && \ | ||
mkdir /var/log/consul-template | ||
|
||
# Copy over configuration files and scripts | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY openlmis.conf /etc/consul-template/openlmis.conf | ||
COPY run.sh /home/run.sh | ||
|
||
# Add a logrotate configuration file for nginx and consul-template | ||
COPY logrotate.conf /etc/logrotate.d/nginx | ||
|
||
# Change permissions for logrotate.conf | ||
RUN chmod 644 /etc/logrotate.d/nginx | ||
|
||
# Set volumes for log files | ||
VOLUME [ "/var/log/nginx", "/var/log/consul-template" ] | ||
|
||
ENTRYPOINT [ "/home/run.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/var/log/nginx/log/*.log /var/log/consul-template/*.log { | ||
daily | ||
rotate 7 | ||
compress | ||
missingok | ||
notifempty | ||
create 0660 root root | ||
} |