From b280908bf174bba07687f0ebc3ceecfd40f780d9 Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Tue, 10 Oct 2023 12:12:28 +0300 Subject: [PATCH 1/7] add dockerfile --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ccb8068 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:3.10 +WORKDIR /backup +RUN pip install backup-github-org==1.0.4 +ENTRYPOINT ["/usr/local/bin/backup-github", "--all", "-t", "$ACCESS_TOKEN", "-o", "./backup/", + "--metrics_path", "./metrics/${ORGANIZATION}_github_backup.prom", "$ORGANIZATION", ">", "./logs_${ORGANIZATION}.log"] From 929c50b7b39a02b4f8db8b55957cfffe81c7ffa9 Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Thu, 12 Oct 2023 15:27:48 +0300 Subject: [PATCH 2/7] fix: Dockerfile --- Dockerfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ccb8068..c153b71 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,15 @@ FROM python:3.10 WORKDIR /backup + +ENV ACCESS_TOKEN="" +ENV ORGANIZATION="" + +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y git + +RUN mkdir "/backup/backup" +RUN mkdir "/backup/metrics" + RUN pip install backup-github-org==1.0.4 -ENTRYPOINT ["/usr/local/bin/backup-github", "--all", "-t", "$ACCESS_TOKEN", "-o", "./backup/", - "--metrics_path", "./metrics/${ORGANIZATION}_github_backup.prom", "$ORGANIZATION", ">", "./logs_${ORGANIZATION}.log"] + +ENTRYPOINT backup-github --all -t $ACCESS_TOKEN -o /backup/backup --metrics_path /backup/metrics/${ORGANIZATION}_github_backup.prom $ORGANIZATION From a590f6a6483f9db78dd22aa869a3b1648213cbbe Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Thu, 12 Oct 2023 15:35:10 +0300 Subject: [PATCH 3/7] fix: run command --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c153b71..46bcd98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,3 +13,5 @@ RUN mkdir "/backup/metrics" RUN pip install backup-github-org==1.0.4 ENTRYPOINT backup-github --all -t $ACCESS_TOKEN -o /backup/backup --metrics_path /backup/metrics/${ORGANIZATION}_github_backup.prom $ORGANIZATION + +# Run command: docker run -d -v .\backup:/backup/backup -v .\metrics:/backup/metrics -e ACCESS_TOKEN={} -e ORGANIZATION={} \ No newline at end of file From fc9cd8a7c2a9ee68257b9325919fe0b4c0114a34 Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Thu, 12 Oct 2023 16:41:21 +0300 Subject: [PATCH 4/7] fix: Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 46bcd98..e1ca719 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,6 @@ RUN mkdir "/backup/metrics" RUN pip install backup-github-org==1.0.4 -ENTRYPOINT backup-github --all -t $ACCESS_TOKEN -o /backup/backup --metrics_path /backup/metrics/${ORGANIZATION}_github_backup.prom $ORGANIZATION +ENTRYPOINT backup-github --all -t $ACCESS_TOKEN -o /backup/backup --metrics_path /backup/metrics/${ORGANIZATION}.prom $ORGANIZATION -# Run command: docker run -d -v .\backup:/backup/backup -v .\metrics:/backup/metrics -e ACCESS_TOKEN={} -e ORGANIZATION={} \ No newline at end of file +# Run command: docker run -rm -v .\backup:/backup/backup -v .\metrics:/backup/metrics -e ACCESS_TOKEN={} -e ORGANIZATION={} \ No newline at end of file From 72e8879b5590d887d9097241efcbb1c70d3d95bd Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Fri, 13 Oct 2023 11:04:42 +0300 Subject: [PATCH 5/7] fix: update version in Dockerfile with release --- .releaserc.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.releaserc.json b/.releaserc.json index a5a023d..8ad8bc7 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -37,6 +37,12 @@ "prepareCmd": "sed -i 's/^version.*$/version = \"${nextRelease.version}\"/' pyproject.toml ; cat pyproject.toml" } ], + [ + "@semantic-release/exec", + { + "prepareCmd": "sed -i 's/^version.*$/backup-github-org==\"${nextRelease.version}\"/' Dockerfile ; cat Dockerfile" + } + ], [ "@semantic-release/git", { From 9e463ba1e489866f8533a009d5917ed725568af3 Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Mon, 16 Oct 2023 09:53:27 +0300 Subject: [PATCH 6/7] fix: update version --- .releaserc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.releaserc.json b/.releaserc.json index 8ad8bc7..8d94803 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -40,7 +40,7 @@ [ "@semantic-release/exec", { - "prepareCmd": "sed -i 's/^version.*$/backup-github-org==\"${nextRelease.version}\"/' Dockerfile ; cat Dockerfile" + "prepareCmd": "sed -i 's/backup-github-org.*$/backup-github-org==${nextRelease.version}/' Dockerfile ; cat Dockerfile" } ], [ From 500901e82a21cb792579d8bcceff442ab3e5ad5c Mon Sep 17 00:00:00 2001 From: Karina5005 Date: Tue, 17 Oct 2023 10:46:55 +0300 Subject: [PATCH 7/7] fix: pr comments --- Dockerfile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1ca719..1640d2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,12 @@ FROM python:3.10 WORKDIR /backup -ENV ACCESS_TOKEN="" -ENV ORGANIZATION="" +ARG VERSION +ENV DEBIAN_FRONTEND=noninteractive +RUN mkdir /backup/backup && mkdir /backup/metrics \ + && pip install backup-github-org==${VERSION} -RUN apt-get update && apt-get upgrade -y && \ - apt-get install -y git +CMD ["backup-github", "--help"] -RUN mkdir "/backup/backup" -RUN mkdir "/backup/metrics" - -RUN pip install backup-github-org==1.0.4 - -ENTRYPOINT backup-github --all -t $ACCESS_TOKEN -o /backup/backup --metrics_path /backup/metrics/${ORGANIZATION}.prom $ORGANIZATION - -# Run command: docker run -rm -v .\backup:/backup/backup -v .\metrics:/backup/metrics -e ACCESS_TOKEN={} -e ORGANIZATION={} \ No newline at end of file +# Build: docker build . -t backup --build-arg VERSION=1.0.4 +# Run: docker run --rm -v .\backup:/backup/backup -v .\metrics:/backup/metrics backup backup-github --all -t "token" -o "/backup/backup" --metrics_path "/backup/metrics/backup.prom" "organization" \ No newline at end of file