add ci/cd

This commit is contained in:
Elizabeth Hunt 2024-08-07 20:14:13 -07:00
parent 514b033884
commit b4c11c8b53
Signed by: simponic
GPG Key ID: 2909B9A7FF6213EE
7 changed files with 79 additions and 5 deletions

55
.drone.yml Normal file
View File

@ -0,0 +1,55 @@
---
kind: pipeline
type: docker
name: build
steps:
- name: run tests
image: python:3.12
commands:
- pip install poetry
- poetry install --with main,dev
- poetry run pytest
trigger:
event:
- pull_request
---
kind: pipeline
type: docker
name: deploy
steps:
- name: run tests
image: python:3.12
commands:
- pip install poetry
- poetry install --with main,dev
- poetry run pytest
- name: docker
image: plugins/docker
settings:
username:
from_secret: gitea_packpub_username
password:
from_secret: gitea_packpub_password
registry: git.hatecomputers.club
repo: git.hatecomputers.club/hatecomputers/kennel
- name: ssh
image: appleboy/drone-ssh
settings:
host: hatecomputers.club
username: root
key:
from_secret: cd_ssh_key
port: 22
command_timeout: 2m
script:
- systemctl restart docker-compose@kennel
trigger:
branch:
- main
event:
- push

View File

@ -5,8 +5,8 @@ COPY ./pyproject.toml ./poetry.lock* /tmp/
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
FROM python:3.12
WORKDIR /code
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY kennel /code/src
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "80"]
WORKDIR /app
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
COPY kennel /app/kennel
CMD ["uvicorn", "kennel.main:app", "--host", "0.0.0.0", "--port", "80"]

0
data/.gitkeep Normal file
View File

2
data/database/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.sqlite
*.db

0
data/database/.gitkeep Normal file
View File

17
docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: "3"
services:
api:
restart: always
build: .
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8000/healthcheck"]
interval: 5s
timeout: 10s
retries: 5
env_file: .env
volumes:
- ./data:/app/data
ports:
- "127.0.0.1:60613:8000"

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB