Improve docker setup and update scripts
This commit is contained in:
+10
-7
@@ -1,15 +1,18 @@
|
||||
# Use lightweight Nginx + Git
|
||||
# environment variables necessary to run:
|
||||
# REPO_URL the url of this repo
|
||||
# BRANCH the branch to work at
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
# Install git and bash
|
||||
RUN apk add --no-cache git bash
|
||||
|
||||
# Copy nginx config
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy update script
|
||||
COPY update.sh /update.sh
|
||||
RUN chmod +x /update.sh
|
||||
|
||||
# Start update loop + nginx
|
||||
CMD ["/bin/bash", "-c", "/update.sh & nginx -g 'daemon off;'"]
|
||||
# Add the cron job to run every 30 minutes
|
||||
# Redirecting to /proc/1/fd/1 ensures the script's echo statements show up in `docker logs`
|
||||
RUN echo "*/30 * * * * bash /update.sh > /proc/1/fd/1 2>&1" > /etc/crontabs/root
|
||||
|
||||
# Start the cron daemon in the background (-b) and nginx in the foreground
|
||||
CMD crond -b && nginx -g 'daemon off;'
|
||||
|
||||
Reference in New Issue
Block a user