You've already forked pypi-proxy
Compare commits
9 Commits
f1c4b2183d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 7675c2138e | |||
| c150a09f92 | |||
| cc04f0e9aa | |||
| 42ef0f96f6 | |||
| a35bbe7c35 | |||
| 5f439808e1 | |||
| 78c910b30c | |||
| ef0ab15d60 | |||
| 434627f001 |
59
.github/workflows/ci.yml
vendored
Normal file
59
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
tags:
|
||||||
|
- "!**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Login to Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create docker image
|
||||||
|
uses: go-semantic-release/action@v1
|
||||||
|
with:
|
||||||
|
hooks: exec
|
||||||
|
custom-arguments: --provider=gitea
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
GITEA_HOST: ${{ vars.G_SERVER_URL}}
|
||||||
|
|
||||||
|
- name: ntfy-success-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
topic: 'ci-status'
|
||||||
|
priority: 4
|
||||||
|
tags: +1,partying_face,action,successfully,completed
|
||||||
|
details: Workflow has been successfully completed!
|
||||||
|
icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
- name: ntfy-failed-notifications
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ vars.NTFY_URL }}'
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_TOKEN }}" }'
|
||||||
|
topic: 'ci-status'
|
||||||
|
priority: 5
|
||||||
|
tags: +1,partying_face,action,failed
|
||||||
|
details: Workflow has failed!
|
||||||
|
actions: 'default'
|
||||||
22
.semrelrc
Normal file
22
.semrelrc
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"provider": {
|
||||||
|
"name": "gitea"
|
||||||
|
},
|
||||||
|
"changelog-generator": {
|
||||||
|
"name": "default",
|
||||||
|
"options": {
|
||||||
|
"emojis": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hooks": {
|
||||||
|
"names": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"exec_on_success": "docker buildx build --progress=plain -t guisea/pypi-proxy:v{{.NewRelease.Version}} -t guisea/pypi-proxy:latest --push .",
|
||||||
|
"exec_on_no_release": "echo {{.Reason}}: {{.Message}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
FROM nginx:latest AS build
|
FROM nginx:latest AS build
|
||||||
|
|
||||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
||||||
ADD --chmod=a+x entrypoint/docker-entrypoint.sh /docker-entrypoint.sh
|
COPY entrypoint/docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
|
||||||
# Create the folder structure for the cache
|
# Create the folder structure for the cache
|
||||||
RUN mkdir -p /var/lib/nginx/pypi && \
|
RUN mkdir -p /var/lib/nginx/pypi && \
|
||||||
chown -R www-data:www-data /var/lib/nginx
|
chown -R www-data:www-data /var/lib/nginx && \
|
||||||
|
chmod a+x /docker-entrypoint.sh
|
||||||
|
|
||||||
FROM scratch as final
|
FROM scratch as final
|
||||||
|
|
||||||
@@ -17,6 +18,8 @@ VOLUME [ "/var/lib/nginx/pypi" ]
|
|||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ENV TZ=Pacific/Auckland
|
ENV TZ=Pacific/Auckland
|
||||||
|
# Transport scheme default is https
|
||||||
|
ENV TRANSPORT_SCHEME=https
|
||||||
|
|
||||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||||
|
|
||||||
|
|||||||
@@ -42,3 +42,4 @@ To use this proxy see below Compose File for Docker Swarm.
|
|||||||
- traefik.http.routers.pypi.tls.certresolver=le
|
- traefik.http.routers.pypi.tls.certresolver=le
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.docker.network=traefik-net
|
- traefik.docker.network=traefik-net
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ http {
|
|||||||
|
|
||||||
location / {
|
location / {
|
||||||
# Replace any reference to actual pypi w/ caching proxy
|
# Replace any reference to actual pypi w/ caching proxy
|
||||||
sub_filter 'https://pypi.org' $scheme://$host;
|
sub_filter 'https://pypi.org' %%TRANSPORT_SCHEME%%://$host;
|
||||||
sub_filter 'https://files.pythonhosted.org' $scheme://%%PYPI_FILES_HOSTNAME%%;
|
sub_filter 'https://files.pythonhosted.org' %%TRANSPORT_SCHEME%%://%%PYPI_FILES_HOSTNAME%%;
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
sub_filter_types '*';
|
sub_filter_types '*';
|
||||||
proxy_pass https://pypi;
|
proxy_pass https://pypi;
|
||||||
@@ -90,8 +90,8 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location ^~ /simple {
|
location ^~ /simple {
|
||||||
sub_filter 'https://pypi.org' $scheme://$host;
|
sub_filter 'https://pypi.org' %%TRANSPORT_SCHEME%%://$host;
|
||||||
sub_filter 'https://files.pythonhosted.org' $scheme://%%PYPI_FILES_HOSTNAME%%;
|
sub_filter 'https://files.pythonhosted.org' %%TRANSPORT_SCHEME%%://%%PYPI_FILES_HOSTNAME%%;
|
||||||
sub_filter_types '*';
|
sub_filter_types '*';
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
# Make sure URI ends with /
|
# Make sure URI ends with /
|
||||||
@@ -128,7 +128,7 @@ http {
|
|||||||
|
|
||||||
location / {
|
location / {
|
||||||
# Replace any reference to actual pypi w/ caching proxy
|
# Replace any reference to actual pypi w/ caching proxy
|
||||||
sub_filter 'https://files.pythonhosted.org' $scheme://%%PYPI_FILES_HOSTNAME%%;
|
sub_filter 'https://files.pythonhosted.org' %%TRANSPORT_SCHEME%%://%%PYPI_FILES_HOSTNAME%%;
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
sub_filter_types '*';
|
sub_filter_types '*';
|
||||||
proxy_pass https://pypi-files;
|
proxy_pass https://pypi-files;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ fi
|
|||||||
|
|
||||||
sed -i -e "s|%%PYPI_FILES_HOSTNAME%%|${PYPI_FILES_HOSTNAME}|g" \
|
sed -i -e "s|%%PYPI_FILES_HOSTNAME%%|${PYPI_FILES_HOSTNAME}|g" \
|
||||||
-e "s|%%PYPI_HOSTNAME%%|${PYPI_HOSTNAME}|g" \
|
-e "s|%%PYPI_HOSTNAME%%|${PYPI_HOSTNAME}|g" \
|
||||||
|
-e "s|%%TRANSPORT_SCHEME%%|${TRANSPORT_SCHEME}|g" \
|
||||||
/etc/nginx/nginx.conf
|
/etc/nginx/nginx.conf
|
||||||
|
|
||||||
if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
|
if [ "$1" = "nginx" -o "$1" = "nginx-debug" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user