dev #11

Merged
k1nq merged 76 commits from dev into master 2025-11-30 04:48:35 +00:00
3 changed files with 51 additions and 3 deletions
Showing only changes of commit 0e48023258 - Show all commits

View File

@ -21,6 +21,11 @@ jobs:
docker build -t ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:app -f app/Dockerfile .
docker push ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:app
- name: Build and push migrations image
run: |
docker build -t ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:migrations -f migrations/Dockerfile .
docker push ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:migrations
deploy:
runs-on: ubuntu-latest
needs: build
@ -28,7 +33,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Instasll SSH key
- name: Install SSH key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
@ -47,6 +52,7 @@ jobs:
ssh ${{ secrets.LXC_USER }}@${{ secrets.LXC_HOST }} << 'EOF'
echo "${{ secrets.TOKEN }}" | docker login ${{ secrets.GIT_HOST }} -u ${{ secrets.USERNAME }} --password-stdin
docker pull ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:app
docker pull ${{ secrets.GIT_HOST }}/${{ gitea.repository }}:migrations
cd /srv/app
docker compose up -d --force-recreate
docker image prune -f

View File

@ -26,8 +26,24 @@ services:
ports:
- "80:8000"
depends_on:
- postgres
- redis
postgres:
condition: service_started
redis:
condition: service_started
migrations:
condition: service_completed_successfully
migrations:
image: ${GIT_HOST}/${GIT_USER}/${GIT_REPO}:migrations
restart: "no"
env_file:
- .env
environment:
DB_HOST: postgres
REDIS_URL: redis://redis:6379/0
depends_on:
postgres:
condition: service_started
postgres:
image: postgres:16-alpine

26
migrations/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1.7
FROM ghcr.io/astral-sh/uv:python3.14-alpine AS builder
WORKDIR /opt/migrations
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
COPY app ./app
COPY migrations ./migrations
COPY alembic.ini .
FROM python:3.14-alpine AS runtime
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
ENV PATH="/opt/app/.venv/bin:${PATH}"
WORKDIR /opt/app
RUN apk add --no-cache postgresql-libs
COPY --from=builder /opt/migrations/.venv /opt/app/.venv
COPY app ./app
COPY migrations ./migrations
COPY alembic.ini .
COPY pyproject.toml .
ENTRYPOINT ["alembic", "upgrade", "head"]