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

!/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/*

!/pystapi-validator/pyproject.toml
!/pystapi-validator/README.md
!/pystapi-validator/src/*
!/pystapi-validator/tests/*
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
if: ${{ matrix.python-version == '3.12' }}
with:
path: site/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
uses: docker/build-push-action@v6
with:
push: false
build-args: PYTHON_VERSION=${{ matrix.python-version }}

docs:
name: Deploy docs
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pypi.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
TAG: ${{ github.ref_name }}
id: split
run: echo "package_name=${TAG%%/*}" >> $GITHUB_OUTPUT

release:
name: Release ${{ needs.package_name.outputs.package_name }}
runs-on: ubuntu-latest
Expand All @@ -43,3 +44,30 @@ 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 Docker Image
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"]