diff --git a/.drone.yml b/.drone.yml index 26af5ff..ad69fa0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,7 +16,21 @@ steps: when: branch: - main -- name: test +- name: docker-dev + image: plugins/docker + settings: + registry: git.jbranan.com + dry_run: false + username: jblu + password: + from_secret: gittea_drone + repo: git.jbranan.com/jblu/phc + tags: + - dev + when: + branch: + - dev* +- name: test-main image: git.jbranan.com/jblu/phc:latest environment: PHC_PLEX_SECRET_TOKEN: @@ -31,6 +45,8 @@ steps: from_secret: PHC_PLEX_PROTOCOL PHC_PLEX_PORT: from_secret: PHC_PLEX_PORT + CRON: + from_secret: CRON commands: - echo $PHC_PLEX_SECRET_TOKEN - echo $PHC_HEALTHCHECK_URL @@ -38,4 +54,37 @@ steps: - echo $PHC_PLEX_HOST - echo $PHC_PLEX_PROTOCOL - echo $PHC_PLEX_PORT - - /bin/sh /opt/phc.sh \ No newline at end of file + - echo $CRON + - /bin/sh /opt/phc.sh + when: + branch: + - main +- name: test-dev + image: git.jbranan.com/jblu/phc:dev + environment: + PHC_PLEX_SECRET_TOKEN: + from_secret: PHC_PLEX_SECRET_TOKEN + PHC_HEALTHCHECK_URL: + from_secret: PHC_HEALTHCHECK_URL + PHC_HEALTHCHECK_ID: + from_secret: PHC_HEALTHCHECK_ID + PHC_PLEX_HOST: + from_secret: PHC_PLEX_HOST + PHC_PLEX_PROTOCOL: + from_secret: PHC_PLEX_PROTOCOL + PHC_PLEX_PORT: + from_secret: PHC_PLEX_PORT + CRON: + from_secret: CRON + commands: + - echo $PHC_PLEX_SECRET_TOKEN + - echo $PHC_HEALTHCHECK_URL + - echo $PHC_HEALTHCHECK_ID + - echo $PHC_PLEX_HOST + - echo $PHC_PLEX_PROTOCOL + - echo $PHC_PLEX_PORT + - echo $CRON + - /bin/sh /opt/phc.sh + when: + branch: + - dev* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 042d0c3..f4dc38b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ -from alpine:latest -RUN apk add --no-cache curl -COPY crontab opt +FROM alpine:latest +RUN apk add --no-cache curl supercronic COPY entrypoint.sh opt COPY phc.sh opt -RUN crontab /opt/crontab RUN chmod +x /opt/entrypoint.sh RUN chmod +x /opt/phc.sh CMD ["/opt/entrypoint.sh"] \ No newline at end of file diff --git a/crontab b/crontab deleted file mode 100644 index e3506cb..0000000 --- a/crontab +++ /dev/null @@ -1 +0,0 @@ -*/30 * * * * . /etc/environment; sh /opt/phc.sh >> /logfile \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index ca10c91..e5d8951 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/sh -printenv | grep -v "no_proxy" >> /etc/environment +CRON_CONFIG_FILE="/opt/crontab" -crond -f \ No newline at end of file +echo "${CRON} sh /opt/phc.sh" > $CRON_CONFIG_FILE + +exec supercronic -passthrough-logs -quiet $CRON_CONFIG_FILE \ No newline at end of file