From 533b0489dfd0ea7f3783b0c0ed8c4c7ff80689c5 Mon Sep 17 00:00:00 2001 From: Thyago Lopes Date: Tue, 12 Sep 2023 14:02:42 +0200 Subject: [PATCH 1/7] Update Dockerfile --- .dockerignore | 20 ++++++++++++++++++++ CHANGELOG.md | 19 +++++++++++++++++++ Dockerfile | 15 ++++++++++----- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 CHANGELOG.md diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e256820 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +tmp/* +log/* +db/*.sqlite3 +.git +.github + +.env +.env.* + +/vendor/* +/test/* + +*.DS_Store +.vscode/ +*.swp +*~ +*.md + +run +build diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..81a143e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +List of changes made by version. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). + +## [1.0.0] - 2023-09-08 + +### Added + +- Direct download of IP list from Bright Data (#2). + +### Fixed + +- Some comments. + +### Changed + +- Upgrade version to 1.0.0. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5a6bca7..292270c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,20 @@ -FROM alpine +FROM alpine:3.20 +LABEL org.opencontainers.image.source https://github.com/apptweak/simple-proxy-rotator RUN apk add --no-cache \ + openssl \ curl \ bash \ git \ - dumb-init \ - openssl + dumb-init + +# Make sure to use bash with pipefail in case something +# fails while being piped to another command in the docker-build +SHELL ["/bin/bash", "-o", "pipefail", "-c"] WORKDIR /app -ADD glider glider.conf entrypoint.sh ./ +COPY glider glider.conf entrypoint.sh ./ EXPOSE 15000 ENTRYPOINT ["/app/entrypoint.sh"] -CMD ["/app/glider", "-config", "/app/glider.conf"] \ No newline at end of file +CMD ["/app/glider", "-config", "/app/glider.conf"] From dcdb6e1567ec60d81eb92ba8d21a38f7c61718c4 Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:46:26 +0200 Subject: [PATCH 2/7] Add Makefile and VERSION file --- Makefile | 13 +++++++++++++ VERSION | 1 + 2 files changed, 14 insertions(+) create mode 100644 Makefile create mode 100644 VERSION diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bbcfefc --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +REGISTRY_HOST=ghcr.io +USERNAME=apptweak +PROJECT=simple-proxy-rotator +VERSION := $(shell cat VERSION) +IMAGE=$(REGISTRY_HOST)/$(USERNAME)/$(PROJECT):$(VERSION) + +build: + docker build --platform "linux/x86_64" --tag "$(IMAGE)" -f Dockerfile . + # read --local --silent --prompt "Docker account's password: " passwd + # echo "$passwd" | docker login --username apptweakci --password-stdin + # gh auth token | docker login --username apptweakci --password-stdin ${IMAGE} + docker push "$(IMAGE)" + diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..2bf5ad0 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +stable From 4c7770689d69a2a54e63df0f23f3ff0df0a0d275 Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:07:21 +0200 Subject: [PATCH 3/7] Add github-action workflows to build&push Docker image and lint Dockerfile --- .github/dependabot.yml | 9 +++++ .github/workflows/hadolint.yml | 22 ++++++++++++ .github/workflows/publish-docker-image.yml | 40 ++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/hadolint.yml create mode 100644 .github/workflows/publish-docker-image.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a6b2c49 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: "docker" # See documentation for possible values + directory: "/" # Location of package manifests + open-pull-requests-limit: 5 + schedule: + interval: "monthly" + reviewers: + - "apptweak/qawaii" diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml new file mode 100644 index 0000000..9c7acf8 --- /dev/null +++ b/.github/workflows/hadolint.yml @@ -0,0 +1,22 @@ +name: Hadolint + +on: + push: + branches: + - "main" + paths: + - "Dockerfile" + pull_request: + types: [opened, synchronize] + paths: + - "Dockerfile" + +jobs: + hadolint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hadolint/hadolint-action@v1.6.0 + with: + dockerfile: Dockerfile + ignore: DL3008 diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml new file mode 100644 index 0000000..070e155 --- /dev/null +++ b/.github/workflows/publish-docker-image.yml @@ -0,0 +1,40 @@ +name: Build & Push Docker image + +on: + push: + paths-ignore: + - "README.md" + branches: + - "main" + +env: + REGISTRY: ghcr.io + USERNAME: apptweak + VERSION: stable + # Fullname of the repo in the style `owner/name` + # REF: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + PROJECT: ${{ github.repository }} + +jobs: + build-stable: + runs-on: ubuntu-latest + steps: + - name: Checkout to branch + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.USERNAME }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push the container to GitHub Container Registry using tag + uses: docker/build-push-action@v5.3.0 + with: + context: . + platforms: linux/amd64 + tags: | + ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.VERSION }} + push: true + provenance: false From b2f1dd371eaed320226885a6a0cce78ccd3cb7ee Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Sat, 7 Sep 2024 02:40:45 +0200 Subject: [PATCH 4/7] Update hadolint rule --- .github/workflows/hadolint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index 9c7acf8..1d831fb 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -19,4 +19,4 @@ jobs: - uses: hadolint/hadolint-action@v1.6.0 with: dockerfile: Dockerfile - ignore: DL3008 + ignore: DL3018 From cbbfe8261302718116be717e120689ccc9f2625f Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Sat, 7 Sep 2024 02:41:27 +0200 Subject: [PATCH 5/7] Add and push docker image's stable tag --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bbcfefc..3863b23 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,14 @@ REGISTRY_HOST=ghcr.io USERNAME=apptweak PROJECT=simple-proxy-rotator VERSION := $(shell cat VERSION) -IMAGE=$(REGISTRY_HOST)/$(USERNAME)/$(PROJECT):$(VERSION) +IMAGE_NAME=$(REGISTRY_HOST)/$(USERNAME)/$(PROJECT) +IMAGE=$(IMAGE_NAME):$(VERSION) build: - docker build --platform "linux/x86_64" --tag "$(IMAGE)" -f Dockerfile . + docker build -f Dockerfile --platform "linux/x86_64" --tag "$(IMAGE)" --tag "$(IMAGE_NAME):stable" . # read --local --silent --prompt "Docker account's password: " passwd # echo "$passwd" | docker login --username apptweakci --password-stdin # gh auth token | docker login --username apptweakci --password-stdin ${IMAGE} docker push "$(IMAGE)" + docker push "$(IMAGE_NAME):stable" From 2b1b903d01e171fdf8ea8245115db4f99ff3be8e Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Tue, 7 Oct 2025 07:48:09 +0200 Subject: [PATCH 6/7] Add Renovate configuration for Dockerfile dependency management --- .github/renovate.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/renovate.json diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..dd74694 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "enabledManagers": ["dockerfile"], + "labels": ["dependencies", "renovate", "docker"], + "prConcurrentLimit": 5, + "rangeStrategy": "bump", + "separateMinorPatch": true, + "packageRules": [ + { + "matchUpdateTypes": ["major"], + "enabled": false + } + ], + "dockerfile": { + "updateFiles": ["Dockerfile"], + "fileMatch": ["Dockerfile"] + } + } From 535fbf79d81e7651a63876ed8e5c3a6bbc3c8404 Mon Sep 17 00:00:00 2001 From: "David A." <3106338+Dakad@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:25:50 +0200 Subject: [PATCH 7/7] Update Dockerfile and README for improved configuration and health checks. - Add build arguments for Alpine version, build date, and CVS reference in Dockerfile. - Added additional labels to Dockerfile for better image metadata. - Implemented a health check in Dockerfile to monitor service availability. - Updated README to reflect changes in Docker commands and usage examples, ensuring clarity and accuracy. --- Dockerfile | 18 ++++++++++++++++-- README.md | 23 ++++++++++++++--------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 292270c..208bd9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,16 @@ -FROM alpine:3.20 -LABEL org.opencontainers.image.source https://github.com/apptweak/simple-proxy-rotator +ARG ALPINE_VERSION=3.20 +FROM alpine:${ALPINE_VERSION} + +ARG BUILD_DATE= +ARG CVS_REF= +LABEL org.opencontainers.image.title="Simple Proxy Rotator" +LABEL org.opencontainers.image.description="Simple http(s) forward Proxy Rotator using glider" +LABEL org.opencontainers.image.source="https://github.com/apptweak/simple-proxy-rotator" +LABEL org.opencontainers.image.url="https://github.com/apptweak/simple-proxy-rotator" +LABEL org.opencontainers.image.vendor="AppTweak" +LABEL org.opencontainers.image.version=${CVS_REF} +LABEL org.opencontainers.image.created=${BUILD_DATE} + RUN apk add --no-cache \ openssl \ curl \ @@ -16,5 +27,8 @@ COPY glider glider.conf entrypoint.sh ./ EXPOSE 15000 +HEALTHCHECK --interval=60s --timeout=30s --start-period=10s --retries=3 \ + CMD nc -z localhost 15000 || exit 1 + ENTRYPOINT ["/app/entrypoint.sh"] CMD ["/app/glider", "-config", "/app/glider.conf"] diff --git a/README.md b/README.md index fa51c42..e99ebe8 100644 --- a/README.md +++ b/README.md @@ -25,28 +25,33 @@ The proxy list can be configured in two ways : The proxy list should have 1 proxy per line using the following format : `http://[username]:[password]@[host]:[port]`. Example -```` +``` http://user1:password1@12.34.56.78:1111 http://user2:password2@98.76.54.32:2222 ... -```` +``` ## Usage ### Start the container using a downloadable proxy list ```` -docker run -p 1234:15000 -e PROXY_LIST_URL=https://gist.githubusercontent.com/you/private-gist-hash/raw/proxy-list.txt almathie/simple-proxy-rotator -```` +docker build . -f Dockerfile -t apptweak/simplpe-proxy-rotator +``` + + +``` +docker run -p 1234:15000 -e PROXY_LIST_URL=https://gist.githubusercontent.com/you/private-gist-hash/raw/proxy-list.txt apptweak/simple-proxy-rotator +``` ### Start the container using a volume mounted proxy list -```` -docker run -p 1234:15000 -v /path/to/proxy-list.txt:/app/proxy-list.txt almathie/simple-proxy-rotator -```` +``` +docker run -p 1234:15000 -v /path/to/proxy-list.txt:/app/proxy-list.txt apptweak/simple-proxy-rotator +``` ### Use the rotator -```` +``` curl -x "http://127.0.0.1:1234" "https://google.com" -```` \ No newline at end of file +```