Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tmp/*
log/*
db/*.sqlite3
.git
.github

.env
.env.*

/vendor/*
/test/*

*.DS_Store
.vscode/
*.swp
*~
*.md

run
build
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 18 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
22 changes: 22 additions & 0 deletions .github/workflows/hadolint.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
dockerfile: Dockerfile
ignore: DL3018
42 changes: 42 additions & 0 deletions .github/workflows/publish-docker-image.yml
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this GH action. We can use Concourse CI to build and publish to our GHCR

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build & Push Docker image

on:
push:
paths-ignore:
- "README.md"
branches:
- "main"
tags:
- "v*"

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/[email protected]
with:
context: .
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.VERSION }}
push: true
provenance: false
29 changes: 24 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
FROM alpine
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 \
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

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"]
CMD ["/app/glider", "-config", "/app/glider.conf"]
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
REGISTRY_HOST=ghcr.io
USERNAME=apptweak
PROJECT=simple-proxy-rotator
VERSION := $(shell cat VERSION)
IMAGE_NAME=$(REGISTRY_HOST)/$(USERNAME)/$(PROJECT)
IMAGE=$(IMAGE_NAME):$(VERSION)

build:
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"

23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]:1111
http://user2:[email protected]: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"
````
```
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0