From 9d778806dd7fc57cd3c90fadd076320e20fed930 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Fri, 26 Mar 2021 20:39:00 +0300
Subject: [PATCH] Better use ONBUILD.

---
 Dockerfile | 1 +
 README.md  | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 8cf1712..b7cbbbe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,4 +16,5 @@ USER nobody
 CMD [ "supersonic", "/crontab" ]
 HEALTHCHECK CMD pgrep supersonic
 RUN supersonic -test /crontab
+ONBUILD COPY crontab /crontab
 ONBUILD RUN supersonic -test /crontab
diff --git a/README.md b/README.md
index d0d9f87..4e5030b 100644
--- a/README.md
+++ b/README.md
@@ -18,13 +18,13 @@ FROM alpine:latest
 COPY --from=supersonic /usr/local/bin/supersonic /usr/local/bin/
 ```
 
-The other pattern is building on top of this image to run some periodic tasks
-like so:
+The other pattern is building on top of this image to run some periodic tasks.
+The `ONBUILD` commands will copy the crontab file and validate it. Just copy
+whatever scripts and install whatever packages you need, like so:
 
 ```
 FROM registry.shore.co.il/cron
 RUN apk add --update --no-cache aws-cli
-COPY crontab /crontab
 COPY script /usr/local/bin/
 ```
 
-- 
GitLab