├── .github └── workflows │ └── docker-image.yml ├── Dockerfile ├── LICENSE ├── README.md └── pypi.conf /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Docker Package 2 | 3 | on: push 4 | 5 | env: 6 | REGISTRY: ghcr.io 7 | IMAGE_NAME: ${{ github.repository }} 8 | 9 | jobs: 10 | build-and-push-image: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | contents: read 14 | packages: write 15 | 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v2 19 | 20 | - name: Log in to the Container registry 21 | if: github.event_name != 'pull_request' 22 | uses: docker/login-action@v3 23 | with: 24 | registry: ${{ env.REGISTRY }} 25 | username: ${{ github.actor }} 26 | password: ${{ secrets.GITHUB_TOKEN }} 27 | 28 | - name: Extract metadata (tags, labels) for Docker 29 | id: meta 30 | uses: docker/metadata-action@v5 31 | with: 32 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 33 | tags: | 34 | type=ref,event=branch 35 | type=ref,event=pr 36 | type=semver,pattern={{version}} 37 | type=semver,pattern={{major}}.{{minor}} 38 | 39 | - name: Build and push Docker image 40 | uses: docker/build-push-action@v5 41 | with: 42 | context: . 43 | push: ${{ github.event_name != 'pull_request' }} 44 | tags: ${{ steps.meta.outputs.tags }} 45 | labels: ${{ steps.meta.outputs.labels }} 46 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx 2 | 3 | COPY pypi.conf /etc/nginx/conf.d/pypi.conf 4 | 5 | CMD ["nginx", "-g", "daemon off;"] 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Docker's IMAGES 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A pypi mirror docker image. 2 | 3 | Just run `docker run -p "5555:80" -d ghcr.io/docker-s-images/pypi-mirror` 4 | 5 | Or use `docker-compose` with `docker-compose.yml` 6 | 7 | ```yaml 8 | version: "3.3" 9 | services: 10 | pypi-mirror: 11 | image: ghcr.io/docker-s-images/pypi-mirror 12 | ports: 13 | - "5555:80" 14 | ``` 15 | -------------------------------------------------------------------------------- /pypi.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name localhost; 3 | listen 80 default_server; 4 | 5 | location /simple { 6 | proxy_pass https://pypi.org; 7 | proxy_set_header Host pypi.org; 8 | proxy_set_header Accept-Encoding "identity"; 9 | proxy_ssl_name pypi.org; 10 | proxy_ssl_server_name on; 11 | sub_filter_once off; 12 | sub_filter ://files.pythonhosted.org/ ://$host/; 13 | } 14 | location /packages { 15 | proxy_pass https://files.pythonhosted.org; 16 | proxy_set_header Host files.pythonhosted.org; 17 | proxy_ssl_name files.pythonhosted.org; 18 | proxy_ssl_server_name on; 19 | } 20 | location /pypi { 21 | proxy_pass https://pypi.org; 22 | proxy_set_header Host pypi.org; 23 | proxy_ssl_name pypi.org; 24 | proxy_ssl_server_name on; 25 | } 26 | } 27 | --------------------------------------------------------------------------------