Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*

!/pyproject.toml
!/README.md
!/uv.lock

!/stapi-fastapi/pyproject.toml
!/stapi-fastapi/README.md
!/stapi-fastapi/src/*
!/stapi-fastapi/tests/*

!/stapi-pydantic/pyproject.toml
!/stapi-pydantic/README.md
!/stapi-pydantic/src/*
!/stapi-pydantic/tests/*
41 changes: 35 additions & 6 deletions .github/workflows/pypi.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "*/v*"

jobs:
package_name:
package-name:
name: Get package name
runs-on: ubuntu-latest
outputs:
Expand All @@ -18,19 +18,20 @@ jobs:
TAG: ${{ github.ref_name }}
id: split
run: echo "package_name=${TAG%%/*}" >> $GITHUB_OUTPUT
release:
name: Release ${{ needs.package_name.outputs.package_name }}

pypi-release:
name: Release ${{ needs.package-name.outputs.package_name }}
runs-on: ubuntu-latest
needs: package_name
needs: package-name
environment:
name: pypi
url: https://pypi.org/p/${{ needs.package_name.outputs.package_name }}
url: https://pypi.org/p/${{ needs.package-name.outputs.package_name }}
permissions:
id-token: write
if: ${{ github.repository }} == 'stapi-spec/pystapi'
defaults:
run:
working-directory: ${{ needs.package_name.outputs.package_name }}
working-directory: ${{ needs.package-name.outputs.package_name }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
Expand All @@ -43,3 +44,31 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ needs.package_name.outputs.package_name}}/dist

docker:
name: Build Docker image
runs-on: ubuntu-latest
needs: package-name
if: ${{ needs.package-name.outputs.package_name }} == 'stapi-fastapi'

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
tags: stapi-spec/stapi-fastapi:${{ github.ref_name }}
build-args: |
PYTHON_VERSION="3.12"
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG PYTHON_VERSION=3.12
ARG BASE_IMAGE=ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-alpine

FROM ${BASE_IMAGE} as base

WORKDIR /app
COPY . /app

RUN uv sync --frozen

CMD ["uv", "run", "fastapi", "dev", "/app/stapi-fastapi/tests/application.py", "--host", "0.0.0.0", "--port", "80"]