diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..72e8ffc0db8aad71a934dd11e5968bd5109e54b4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b72aae660c3b2cd7a3962dd881727108609218ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +~* +*~ +*.sw[op] +*.py[cod] +.DS_Store +__pycache__/ +.vagrant/ +vendor/ +Thumbs.db +*.retry +.svn/ +.sass-cache/ +*.log +a.out +node-modules/ +nbproject/ +*.ipynb +.idea/ +*.egg-info/ +*.o +.classpath +.cache/ +bower_components/ +*.class +*.jar +secring.* +.*.kate-swp +.swp.* +.directory +.Trash-* +build/ +_build/ +dist/ +.tox/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2970e22542b21c62e6d30211e0b09870ff59ce2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM alpine:3.9 as downloader +ARG URL=https://github.com/aptible/supercronic/releases/download/v0.1.8/supercronic-linux-amd64 +ARG SHA1SUM=be43e64c45acd6ec4fce5831e03759c89676a0ea +RUN cd /tmp && \ + wget $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.9 +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 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..17196c5e9c0a73784b3bb2ba6299933de5c80980 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Adar Nimrod + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..147e9dd27a0d5419f9aa8b889593f8cc5a67c924 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# 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 adarnimrod/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 +like so: + +``` +FROM adarnimrod/cron +RUN apk add --update --no-cache aws-cli +COPY crontab /crontab +COPY script /usr/local/bin/ +``` + +## License + +This software is licensed under the MIT license (see `LICENSE.txt`).