Compare commits

9 Commits
dev ... master

Author SHA1 Message Date
Logan Cusano
6a239f3820 Add arm to builds
All checks were successful
Docker Build & Push / build-and-publish (push) Successful in 3m50s
2025-11-19 03:35:43 -05:00
Logan Cusano
5e885dab54 Remove env from the dockerfile and add it to the makefile
All checks were successful
Docker Build & Push / build-and-publish (push) Successful in 42s
2025-11-19 03:25:39 -05:00
Logan Cusano
edf59cb9df Fix registry
Some checks failed
Docker Build & Push / build-and-publish (push) Failing after 21s
2025-11-19 03:23:18 -05:00
Logan Cusano
02b5e7f558 Update secret name
Some checks failed
Docker Build & Push / build-and-publish (push) Failing after 18s
2025-11-19 03:19:11 -05:00
Logan Cusano
5f1b22075a Add build
Some checks failed
Docker Build & Push / build-and-publish (push) Failing after 2m24s
2025-11-19 03:11:44 -05:00
Logan Cusano
5cf67c67d7 fix typo 2025-08-02 02:44:51 -04:00
Logan Cusano
466bc08324 Update model for new UI 2025-08-02 02:44:25 -04:00
Logan Cusano
d39413d0ef Fix video selection 2025-08-02 02:23:55 -04:00
Logan Cusano
1a5e460029 Fix bug in naming 2025-08-02 02:21:33 -04:00
5 changed files with 76 additions and 4 deletions

View File

@@ -0,0 +1,69 @@
name: Docker Build & Push
# Trigger the workflow on pushes to the main branch
on:
push:
branches:
- master
tags:
- 'v*' # Also run on tags starting with 'v' (e.g., v1.0.0)
jobs:
build-and-publish:
# Use a standard Linux runner
runs-on: ubuntu-latest
# Define variables for easy configuration
env:
# Replace 'gitea.local:3000' with your actual Gitea host and port (if non-standard)
REGISTRY: git.vpn.cusano.net
# Image name will be the Gitea repository path (e.g., username/repo-name)
IMAGE_NAME: ${{ gitea.repository }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# Set up QEMU for multi-architecture building (optional, but highly recommended)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Set up Docker Buildx (required for multi-platform and robust builds)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Use your Gitea username for the login
username: ${{ gitea.actor }}
# Use a Personal Access Token (PAT) stored as a Gitea Action secret
# You MUST create a GITEA_TOKEN secret with 'write:packages' scope.
password: ${{ secrets.BUILD_TOKEN }}
# Define image tags based on branch/tag information
- name: Determine Image Tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=,suffix=,enable=true,params=7
type=ref,event=branch
type=semver,pattern=v{{version}}
# Build and Push the Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
# Enable pushing to the registry
push: true
# Select platforms to build for (e.g., standard Linux amd64)
platforms: linux/amd64, linux/arm64
# Use the tags generated in the previous step
tags: ${{ steps.meta.outputs.tags }}
# Use the Dockerfile in the current directory (default: Dockerfile)
file: ./Dockerfile
# Set the build context
context: .

View File

@@ -12,7 +12,6 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the application code into the container
COPY ./app /code/app
COPY ./.env /code/.env
# Expose port 80 to the outside world
EXPOSE 80

View File

@@ -9,6 +9,7 @@ build:
run: build
docker run --rm -it \
-v /mnt/shadowplays/TWIMG-Eligible:/videos:ro \
-v .env:/code/.env:re \
--name $(CONTAINER_NAME) \
-p 8000:8000 \
$(IMAGE_NAME)

View File

@@ -33,8 +33,9 @@ class Video(BaseModel):
class VoteCreate(BaseModel):
decision: str
reason: str
reason: List[str]
recommended_game: Optional[str] = None
timestamp: Optional[float] = None
class Vote(BaseModel):
id: str

View File

@@ -91,13 +91,15 @@ async def get_random_unvoted_video(current_user: dict = Depends(is_user)):
Retrieves a random, unvoted video document from Firestore.
"""
db = get_db()
videos_stream = db.collection('videos').where('has_been_voted', '==', False).limit(1).stream()
videos_stream = db.collection('videos').where('has_been_voted', '==', False).limit(5).stream()
unvoted_videos = [doc.to_dict() for doc in videos_stream]
if not unvoted_videos:
raise HTTPException(status_code=404, detail="No more videos to vote on!")
return Video(**random_video_data)
random_video = random.choice(unvoted_videos)
return Video(**random_video)
@router.post("/{video_id}/vote", status_code=status.HTTP_201_CREATED)