Skip to content

Commit 0fe2c46

Browse files
committed
WIP
1 parent 92fa7e1 commit 0fe2c46

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!dist/*.whl

.github/workflows/publish.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish to PyPI and GHCR
2+
on:
3+
push:
4+
tags:
5+
- test-v*
6+
jobs:
7+
build-and-publish:
8+
runs-on: ubuntu-latest
9+
environment:
10+
name: pypi
11+
url: 'https://pypi.org/p/pypi-browser-webapp'
12+
permissions:
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.13'
19+
- name: Install dependencies
20+
run: pip install build
21+
- name: Build Python artifacts
22+
run: python -m build --sdist --wheel --outdir dist
23+
- name: Publish to PyPI
24+
uses: pypa/gh-action-pypi-publish@release/v1
25+
with:
26+
skip-existing: true
27+
- name: Login to GitHub Container Registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Retrieve wheel name
34+
id: wheel
35+
run: echo "WHEEL=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: .
40+
build-args: |
41+
WHEEL=${{ steps.wheel.outputs.WHEEL }}
42+
tags: |
43+
ghcr.io/chriskuehl/pypi-browser:latest
44+
ghcr.io/chriskuehl/pypi-browser:${{ github.ref_name }}
45+
push: true

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM public.ecr.aws/docker/library/python:3.13
2+
RUN apt-get update && apt-get install -y dumb-init && apt-get clean
3+
ARG WHEEL
4+
COPY "$WHEEL" /tmp/
5+
USER nobody
6+
RUN python -m venv /tmp/venv
7+
RUN /tmp/venv/bin/pip install /tmp/*.whl uvicorn
8+
VOLUME /cache
9+
ENV PYPI_BROWSER_PACKAGE_CACHE_PATH=/cache
10+
CMD ["/usr/bin/dumb-init", "/tmp/venv/bin/uvicorn", "--forwarded-allow-ips=*", "--host", "0.0.0.0", "pypi_browser.app:app"]

0 commit comments

Comments
 (0)