Files
projects/Dockers/gluetun-pia-wireguard-rotator/Dockerfile
T
Bram 2dbaa0ebb0
Build and Push Docker Images / build-and-push (push) Successful in 1m30s
Add HTTP resync endpoint for manual rotation triggering
Expose port 8080 with `/resync` endpoint to trigger on-demand WireGuard rotations. Add RESYNC_PORT and RESYNC_BIND environment variables. Implement thread-safe rotation locking to prevent concurrent runs. Update README with endpoint usage examples.
2026-09-19 21:19:03 +02:00

34 lines
1.0 KiB
Docker

FROM docker:cli
RUN apk add --no-cache ca-certificates tzdata python3 py3-pip \
&& python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir 'croniter==6.2.4' 'cryptography>=42,<47' \
&& apk del py3-pip
ENV PATH="/opt/venv/bin:$PATH"
COPY pia.py rotate.py entrypoint.py entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/rotate.py /usr/local/bin/entrypoint.py /usr/local/bin/entrypoint.sh
ENV TZ=Europe/Brussels
ENV WG_CONFIG_PATH=/config/wireguard/wg0.conf
ENV ROTATOR_STATE_PATH=/config/rotator-state.json
ENV GLUETUN_CONTAINER=m3u-filter-vpn
ENV ROTATE_CRON="0 3 * * *"
ENV REGION_SELECT=fastest
ENV SERVERLIST_CACHE_PATH=/config/cache/pia-serverlist.json
ENV SERVERLIST_CACHE_TTL=24h
ENV SERVERLIST_CACHE_MAX_AGE=168h
ENV TOKEN_CACHE_PATH=/config/cache/pia-token.json
ENV TOKEN_CACHE_TTL=20h
ENV PIA_CA_PATH=/config/cache/ca.rsa.4096.crt
ENV LATENCY_SWITCH_MARGIN_MS=15
ENV HEALTH_CHECK_INTERVAL=10
ENV UNHEALTHY_ROTATE_COOLDOWN=60
ENV RESYNC_PORT=8080
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]