From c4ffcee3a3ebebf97810af8922bbe805410bf117 Mon Sep 17 00:00:00 2001 From: jblu Date: Mon, 19 Jun 2023 19:01:44 -0500 Subject: [PATCH 1/5] changed to supercronic --- Dockerfile | 2 +- crontab | 1 - entrypoint.sh | 9 +++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) delete mode 100644 crontab diff --git a/Dockerfile b/Dockerfile index 042d0c3..eac6b10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ from alpine:latest -RUN apk add --no-cache curl +RUN apk add --no-cache curl,supercronic COPY crontab opt COPY entrypoint.sh opt COPY phc.sh opt 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..beff1c1 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/sh +CRON_CONFIG_FILE="/opt/crontab" -printenv | grep -v "no_proxy" >> /etc/environment +# CRON +get_env CRON +CRON="${CRON:-"5 * * * *"}" -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 From 1ac06a288a414998ff33e098c617b16029150738 Mon Sep 17 00:00:00 2001 From: Jonathan Branan Date: Thu, 22 Jun 2023 03:22:16 -0500 Subject: [PATCH 2/5] added supercronic --- Dockerfile | 2 -- entrypoint.sh | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index eac6b10..340434b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ from alpine:latest RUN apk add --no-cache curl,supercronic -COPY crontab opt 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/entrypoint.sh b/entrypoint.sh index beff1c1..e5d8951 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,10 +1,7 @@ #!/bin/sh + CRON_CONFIG_FILE="/opt/crontab" -# CRON -get_env CRON -CRON="${CRON:-"5 * * * *"}" +echo "${CRON} sh /opt/phc.sh" > $CRON_CONFIG_FILE -echo "${CRON} sh /opt/phc.sh" >> "${CRON_CONFIG_FILE}" - -exec supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}" \ No newline at end of file +exec supercronic -passthrough-logs -quiet $CRON_CONFIG_FILE \ No newline at end of file From 1ac4eb822caf97fd333b0b0f01b22a3cbcd20a3e Mon Sep 17 00:00:00 2001 From: Jonathan Branan Date: Thu, 22 Jun 2023 03:24:19 -0500 Subject: [PATCH 3/5] updated instructions --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 340434b..f0adede 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -from alpine:latest +FROM alpine:latest RUN apk add --no-cache curl,supercronic COPY entrypoint.sh opt COPY phc.sh opt From 0b011a28fd5970ce945cd5aaf6d56de94833671c Mon Sep 17 00:00:00 2001 From: Jonathan Branan Date: Thu, 22 Jun 2023 17:54:02 -0500 Subject: [PATCH 4/5] updated cicd --- .drone.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) 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 From 32a9b1745da020afddaeafabc6dd403c9d962265 Mon Sep 17 00:00:00 2001 From: Jonathan Branan Date: Thu, 22 Jun 2023 18:10:45 -0500 Subject: [PATCH 5/5] updated package --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f0adede..f4dc38b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:latest -RUN apk add --no-cache curl,supercronic +RUN apk add --no-cache curl supercronic COPY entrypoint.sh opt COPY phc.sh opt RUN chmod +x /opt/entrypoint.sh