Skip to content
Snippets Groups Projects
Commit 8a902ac3 authored by nimrod's avatar nimrod
Browse files

Crond image.

parent 36c8bd22
No related branches found
No related tags found
No related merge requests found
Pipeline #2340 passed
......@@ -123,3 +123,19 @@ push-sshd:
needs:
- job: build-sshd
artifacts: true
# crond image:
build-crond:
extends: .build
variables:
CONTEXT: crond
push-crond:
extends: .push
variables:
CONTEXT: crond
IMAGE: cron
needs:
- job: build-crond
artifacts: true
*
FROM alpine:3.14 as downloader
ARG URL=https://github.com/aptible/supercronic/releases/download/v0.1.12/supercronic-linux-amd64
ARG SHA1SUM=048b95b48b708983effb2e5c935a1ef8483d9e3e
WORKDIR /tmp
RUN wget -q $URL && \
echo "$SHA1SUM supercronic-linux-amd64" > sha1.sum && \
sha1sum -c sha1.sum && \
install -m 755 supercronic-linux-amd64 /usr/local/bin/supersonic && \
touch /crontab
FROM alpine:3.14
COPY --from=downloader /usr/local/bin/supersonic /usr/local/bin/supersonic
COPY --from=downloader /crontab /crontab
WORKDIR /tmp
USER nobody
CMD [ "supersonic", "/crontab" ]
HEALTHCHECK CMD pgrep supersonic
RUN supersonic -test /crontab
ONBUILD COPY crontab /crontab
ONBUILD RUN supersonic -test /crontab
# Cron docker
A Docker image for running a Cron daemon, actually running
[Supersonic](https://github.com/aptible/supercronic).
## Usage
There are possible usage patterns for this image. The first is using it in a
multi-stage image build as the source of the `supersonic` binary to incorporate
in your own image like so:
```
FROM registry.shore.co.il/cron as supersonic
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.
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
COPY script /usr/local/bin/
USER root
RUN apk add --update --no-cache aws-cli
USER nobody
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment