From be1d7131a7bc9c256c733250d77a8ca812463cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Gonz=C3=A1lez=20Serrano?= Date: Thu, 4 Jun 2020 14:57:44 +0200 Subject: [PATCH] Initial commit --- .dockerignore | 1 + Dockerfile | 32 ++++++++++++++++++++++++++++++++ README.md | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b4b2f9b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +ARG REPOSITORY=https://github.com/gordalina/cachetool.git +ARG REF=5.0.0 +ARG TARGET_DIR=/opt/cachetool + +FROM composer:latest AS builder + +ARG REPOSITORY +ARG REF +ARG TARGET_DIR + +WORKDIR ${TARGET_DIR} + +RUN cd ${TARGET_DIR} \ + && git clone ${REPOSITORY} . \ + && git checkout ${REF} \ + && composer install --no-dev --optimize-autoloader + + +FROM php:7.4-cli-buster + +MAINTAINER Sbit.io + +ARG TARGET_DIR + +WORKDIR ${TARGET_DIR} + +ENV PATH=$PATH:$TARGET_DIR/bin + +COPY --from=builder ${TARGET_DIR} ${TARGET_DIR} + +#Not using entry ENTRYPOINT for backwards compatibility +CMD [ "cachetool", "help" ] diff --git a/README.md b/README.md index 4884773..568f36f 100644 --- a/README.md +++ b/README.md @@ -1 +1,32 @@ -# docker-cachetool \ No newline at end of file +# docker-cachetool +[![DockerHub Badge](http://dockeri.co/image/sbitio/cachetool)](https://hub.docker.com/r/sbitio/cachetool/) + +A simple docker helper for running [gordalina's cachetool](https://github.com/gordalina/cachetool) + +Invoking without command pints cachetool's help: +```bash +docker run --rm sbitio/cachetool +``` + +## Using +The most common use will be clearing caches. + +Example Using web adapter: +```bash +docker run --rm -v : -w sbitio/cachetool cachetool -v --web --web-url= +``` +Note: You can use docker's `--add-host` to leaverage nameserver resolution + + +## Extending + +You can build containers using a fork: +```bash +docker build . --build-arg REPOSITORY=https://github.com/gordalina/cachetool REF=5.0.0 -t cachetool: +``` + +## Testing code changes +Just mount the new code at `WORKDIR`: +```bash +docker run --rm -v :/opt/cachetool sbitio:cachetool +```