Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a828572678 | |||
| 81ee410452 | |||
|
|
ccee6387ed | ||
|
|
a64a559487 | ||
| adfacc274a | |||
| bc3387a8fc | |||
|
|
50b347886b | ||
| d2010e7352 | |||
|
|
ccc687c7ef | ||
| 8d85b669ef | |||
| ef50b550c7 | |||
| 80373528ec | |||
|
|
5a6051f1d6 | ||
| 9713aa8507 | |||
| fd9dbc048c | |||
| d3d9c86ac8 | |||
| 83e5c66807 | |||
|
|
88b10b47d7 | ||
|
|
2e23de4e9d | ||
| 3fb1755089 | |||
| a050e31bfa | |||
|
|
70401fd0de | ||
|
|
39ceb056f1 | ||
|
|
457b0a234b | ||
|
|
ae44f0e47b | ||
|
|
0cdc7fe629 | ||
|
|
1e705cb627 | ||
| 35040f3c54 | |||
| 63abb64b4f | |||
| 730b57e8e8 | |||
| 3bb5bb6739 | |||
| a3da4ff7f0 | |||
| e11ddc277a | |||
| fafc3f8a29 | |||
|
|
c0c4c31815 | ||
|
|
49199bd776 | ||
| 5e2a2cbe8c | |||
| 81838054da | |||
|
|
fa75d26da8 | ||
|
|
ecccb51625 | ||
| 2c7e0d8641 | |||
| 3977e3add9 | |||
| 143512953b | |||
|
|
e0dc1da4a1 | ||
|
|
1b766f3f22 | ||
| 762a5f3523 | |||
| 0ca067d37b | |||
|
|
d6d48ead0a | ||
| eef2cc3741 | |||
| 93867a5382 | |||
| ed7b4eb908 | |||
| e62eb19647 |
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Lint, Test, Tag, Build and Deploy DEV
|
name: Lint, Test, Tag, Build and Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,13 +6,17 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
- master
|
- master
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**/.github/**"
|
|
||||||
- "**/.gitignore"
|
- "**/.gitignore"
|
||||||
|
- "**/.renovate.json"
|
||||||
- "**/.vscode/**"
|
- "**/.vscode/**"
|
||||||
- "**/README.md"
|
- "**/README.md"
|
||||||
- "**/CHANGELOG.md"
|
- "**/CHANGELOG.md"
|
||||||
- "**/docs/**"
|
- "**/docs/**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
@@ -25,11 +29,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: psf/black@stable
|
- uses: psf/black@stable
|
||||||
with:
|
with:
|
||||||
options: "-l 100 --exclude '/.venv/|alembic/|/__init__.py'"
|
options: "-l 100 --exclude '/.venv/|/__init__.py'"
|
||||||
- uses: creyD/autoflake_action@master
|
- uses: creyD/autoflake_action@master
|
||||||
with:
|
with:
|
||||||
no_commit: True
|
no_commit: True
|
||||||
options: --in-place --remove-all-unused-imports -r --exclude **/__init__.py,**/db/models.py,
|
options: --in-place --remove-all-unused-imports -r --exclude **/__init__.py
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: Adjusted files for isort & autopep
|
commit_message: Adjusted files for isort & autopep
|
||||||
@@ -52,6 +56,7 @@ jobs:
|
|||||||
|
|
||||||
tag:
|
tag:
|
||||||
needs: test
|
needs: test
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for the tags
|
contents: write # for the tags
|
||||||
@@ -78,7 +83,7 @@ jobs:
|
|||||||
major_pattern: "breaking:"
|
major_pattern: "breaking:"
|
||||||
minor_pattern: "feat:"
|
minor_pattern: "feat:"
|
||||||
enable_prerelease_mode: false
|
enable_prerelease_mode: false
|
||||||
version_format: "${major}.${minor}.${patch}-rc${increment}"
|
version_format: "${major}.${minor}.${patch}"
|
||||||
|
|
||||||
- name: Create Tag
|
- name: Create Tag
|
||||||
run: git tag ${{ steps.git_version.outputs.version }}
|
run: git tag ${{ steps.git_version.outputs.version }}
|
||||||
@@ -87,6 +92,7 @@ jobs:
|
|||||||
run: git push origin ${{ steps.git_version.outputs.version }}
|
run: git push origin ${{ steps.git_version.outputs.version }}
|
||||||
|
|
||||||
build_and_push:
|
build_and_push:
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: tag
|
needs: tag
|
||||||
@@ -106,7 +112,7 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ github.ref_name }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
tags: latest
|
tags: latest
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
@@ -115,7 +121,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
build-args: |
|
build-args: |
|
||||||
VERSION=${{ needs.tag.outputs.version }}-${{ github.ref_name }}
|
VERSION=${{ needs.tag.outputs.version }}
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
16
Dockerfile
16
Dockerfile
@@ -1,5 +1,8 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.13-slim
|
||||||
ARG VERSION=unkown
|
ARG VERSION=unknown
|
||||||
|
|
||||||
|
# Create a non-root user
|
||||||
|
RUN useradd appuser
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
@@ -11,15 +14,20 @@ ENV VERSION=${VERSION}
|
|||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
||||||
RUN pip install 'uvicorn[standard]'
|
|
||||||
|
|
||||||
ENV ENV=DEV
|
ENV ENV=DEV
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
USER appuser
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
|
|
||||||
# Install curl
|
# Install curl
|
||||||
RUN apt-get update && apt-get install -y curl && apt-get clean
|
USER root
|
||||||
|
RUN apt-get update && apt-get install --no-install-recommends -y curl && apt-get clean
|
||||||
|
|
||||||
|
# Switch back to non-root user for healthcheck
|
||||||
|
USER appuser
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --retries=5 \
|
HEALTHCHECK --interval=30s --timeout=10s --retries=5 \
|
||||||
CMD curl --fail http://localhost:8000/openapi.json || exit 1
|
CMD curl --fail http://localhost:8000/openapi.json || exit 1
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter, FastAPI, Response
|
||||||
from fastapi import Response
|
|
||||||
from creyPY.fastapi.app import generate_unique_id
|
from creyPY.fastapi.app import generate_unique_id
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from fastapi import FastAPI
|
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from creyPY.fastapi.testing import GenericClient
|
from creyPY.fastapi.testing import GenericClient
|
||||||
|
|
||||||
from .main import app
|
from .main import app
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
7
renovate.json
Normal file
7
renovate.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended",
|
||||||
|
":semanticCommitTypeAll(feat)"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
certifi==2023.11.17 # Testing
|
certifi==2025.1.31 # Testing
|
||||||
iniconfig==2.0.0 # PyTest Testing
|
iniconfig==2.0.0 # PyTest Testing
|
||||||
packaging==23.2 # PyTest Testing
|
packaging==24.2 # PyTest Testing
|
||||||
pluggy==1.3.0 # PyTest Testing
|
pluggy==1.5.0 # PyTest Testing
|
||||||
pytest==7.4.3 # PyTest Testing
|
pytest==8.3.5 # PyTest Testing
|
||||||
|
|
||||||
click==8.1.7 # Uvicorn
|
click==8.1.8 # Uvicorn
|
||||||
httptools==0.6.1 # Uvicorn
|
httptools==0.6.4 # Uvicorn
|
||||||
pyyaml==6.0.1 # Uvicorn
|
pyyaml==6.0.2 # Uvicorn
|
||||||
uvicorn==0.27.0.post1 # Uvicorn
|
uvicorn==0.34.0 # Uvicorn
|
||||||
uvloop==0.19.0 # Uvicorn
|
uvloop==0.21.0 # Uvicorn
|
||||||
watchfiles==0.21.0 # Uvicorn
|
watchfiles==1.0.4 # Uvicorn
|
||||||
websockets==12.0 # Uvicorn
|
websockets==15.0.1 # Uvicorn
|
||||||
|
|
||||||
creyPY==1.3.0 # My own package
|
creyPY[postgres]==3.0.0 # My own package
|
||||||
|
|||||||
Reference in New Issue
Block a user