-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build!: Refactor dependencies and CI
- Loading branch information
Showing
12 changed files
with
1,459 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.venv | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build and Deploy | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
name: Build and Push Docker images | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/itsamirhn/bonbast-api:latest | ||
ghcr.io/itsamirhn/bonbast-api:${{ github.ref_name }} | ||
deploy: | ||
name: Deploy API | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
environment: production | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Deploy to server | ||
uses: easingthemes/ssh-deploy@main | ||
with: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }} | ||
REMOTE_HOST: ${{ secrets.SSH_HOST }} | ||
REMOTE_USER: ${{ secrets.SSH_USERNAME }} | ||
SOURCE: docker-compose.yaml | ||
SCRIPT_AFTER: | | ||
TAG=${{ github.ref_name }} docker compose up -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,4 +219,5 @@ dmypy.json | |
# Cython debug symbols | ||
cython_debug/ | ||
|
||
.deta | ||
.secrets | ||
.pdm-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exclude: migrations | ||
repos: | ||
- repo: https://github.com/pdm-project/pdm | ||
rev: 2.15.3 | ||
hooks: | ||
- id: pdm-lock-check | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: mixed-line-ending | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-merge-conflict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM python:3.12-slim | ||
|
||
WORKDIR /code | ||
|
||
COPY pyproject.toml . | ||
COPY pdm.lock . | ||
|
||
RUN pip3 install "pdm<3" | ||
|
||
RUN pdm install --global --project . --production --fail-fast --no-lock | ||
|
||
COPY . . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
services: | ||
api: | ||
image: ghcr.io/itsamirhn/bonbast-api:${TAG:-latest} | ||
restart: unless-stopped | ||
ports: | ||
- "3000:3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,4 +132,3 @@ async def read_archive_range( | |
date = price.pop("date") | ||
price_range[date] = price | ||
return price_range | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[project] | ||
name = "Bonbast-API" | ||
version = "0.1.0" | ||
authors = [ | ||
{name = "AmirMohammad Hosseini Nasab", email = "awmirhn@gmail.com"}, | ||
] | ||
dependencies = [ | ||
"bonbast~=1.0.2", | ||
"fastapi~=0.111.0", | ||
"fastapi-cache2~=0.2.1", | ||
"httpx~=0.27.0", | ||
"uvicorn~=0.29.0", | ||
"beautifulsoup4~=4.12.3", | ||
] | ||
requires-python = ">=3.11" | ||
readme = "README.md" | ||
license = {text = "MIT"} | ||
|
||
|
||
[tool.pdm] | ||
distribution = false | ||
|
||
[tool.pdm.dev-dependencies] | ||
dev = [ | ||
"pre-commit>=3.7.1", | ||
] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.