Skip to content

Instantly share code, notes, and snippets.

@x-yuri
Last active March 23, 2024 23:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x-yuri/427172d62edc9ac6596d5382365e78b5 to your computer and use it in GitHub Desktop.
Save x-yuri/427172d62edc9ac6596d5382365e78b5 to your computer and use it in GitHub Desktop.
docker + supercronic

docker + supercronic

Use -debug to make it more verbose.

docker-compose.yml:

services:
  supercronic:
    build: .
    command: supercronic crontab

Dockerfile:

FROM alpine:3.17
RUN set -x \
    && apk add --no-cache supercronic shadow \
    && useradd -m app
USER app
COPY crontab .

Dockerfile (before Alpine Linux 3.15):

FROM alpine:3.17
RUN set -x \
    && apk add --no-cache go
RUN go install github.com/aptible/supercronic@v0.2.1

FROM alpine:3.17
RUN set -x \
    && apk add --no-cache shadow \
    && useradd -m app
USER app
COPY --from=0 /root/go/bin/supercronic /usr/local/bin/supercronic
COPY crontab .

crontab:

* * * * * date
@khchine5
Copy link

@x-yuri I think you meant FROM alpine:3.14 instead of FROM alpine:3.17 in the second Dockerfile sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment