Compare commits

8 Commits
main ... main

6 changed files with 160 additions and 2 deletions

19
.env.example Normal file
View File

@@ -0,0 +1,19 @@
# Ivatar Configuration
# Copy this file to .env and customize the values
# Site Configuration
SITE_NAME=My Ivatar Instance
BASE_URL=http://localhost:8080/avatar/
SECURE_BASE_URL=https://your-domain.com/avatar/
# Database Configuration
POSTGRES_PASSWORD=ivatar_secure_password_change_me
# Email Configuration
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
SERVER_EMAIL=ivatar@your-domain.com
DEFAULT_FROM_EMAIL=ivatar@your-domain.com
# Mailgun Configuration (optional)
# MAILGUN_API_KEY=your_mailgun_api_key
# MAILGUN_SENDER_DOMAIN=your-domain.com

View File

@@ -0,0 +1,52 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Install system Dependencies
run: |
apt-get update && apt-get install -y curl jq docker.io
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: gitea.purpleraft.com
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: gitea.purpleraft.com/${{ gitea.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
type=sha,prefix={{branch}}-
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -6,12 +6,13 @@ RUN apk add --no-cache --virtual build-deps build-base gcc python3-dev musl-dev
apk add --no-cache py3-virtualenv openldap-dev libffi-dev mariadb-dev zlib-dev
# RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
RUN git clone https://git.linux-kernel.at/oliver/ivatar.git .
RUN git clone https://gitea.purpleraft.com/external-repos/ivatar.git .
RUN virtualenv -p python3 .virtualenv && \
source .virtualenv/bin/activate && \
pip install --upgrade pip setuptools wheel && \
pip install 2to3 pillow && \
pip install -r requirements.txt
pip install --no-build-isolation -r requirements.txt
RUN apk del build-deps && pip cache purge

View File

@@ -30,6 +30,35 @@ Please be aware that this will not persist any data.
| `POSTGRESQL_PASSWORD` | | - |
## Gitea Actions CI/CD
This repository includes a Gitea Actions workflow that automatically builds and pushes the Docker image to your Gitea container registry.
### Setup Instructions
1. **Create a Personal Access Token:**
- Go to your Gitea instance: https://gitea.purpleraft.com/
- Navigate to Settings → Applications → Generate New Token
- Create a token with `write:packages` permission
- Copy the token value
2. **Add Repository Secret:**
- Go to your repository settings
- Navigate to Secrets and Variables → Actions
- Add a new secret named `GITEA_TOKEN` with your personal access token as the value
3. **Enable Actions (if not already enabled):**
- Ensure Gitea Actions are enabled in your repository settings
- The workflow will trigger on pushes to main/master branches and pull requests
### Workflow Features
- Builds Docker image using Docker Buildx
- Pushes to `gitea.purpleraft.com/{username}/{repository}`
- Creates multiple tags: branch name, latest (for default branch), and commit SHA
- Uses GitHub Actions cache for faster builds
- Runs on pushes and pull requests
## To Do
- Figure out where the pictures are stored
- Write some setup instructions

51
compose.yml Normal file
View File

@@ -0,0 +1,51 @@
---
services:
postgresql:
image: postgres:16-alpine
restart: unless-stopped
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: ivatar
POSTGRES_USER: ivatar
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ivatar_secure_password}
networks:
- ivatar-network
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ivatar -d ivatar
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
ivatar:
image: gitea.purpleraft.com/ryan/ivatar-docker:latest
restart: unless-stopped
depends_on:
postgresql:
condition: service_healthy
ports:
- '8080:8080'
volumes:
- ivatar_data:/ivatar/media
environment:
SITE_NAME: ${SITE_NAME:-My Ivatar Instance}
BASE_URL: ${BASE_URL:-http://localhost:8080/avatar/}
SECURE_BASE_URL: ${SECURE_BASE_URL:-https://your-domain.com/avatar/}
POSTGRESQL_DATABASE: ivatar
POSTGRESQL_USER: ivatar
POSTGRESQL_PASSWORD: ${POSTGRES_PASSWORD:-ivatar_secure_password}
EMAIL_BACKEND: ${EMAIL_BACKEND:-django.core.mail.backends.console.EmailBackend}
SERVER_EMAIL: ${SERVER_EMAIL:-ivatar@your-domain.com}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-ivatar@your-domain.com}
networks:
- ivatar-network
volumes:
postgres_data: null
ivatar_data: null
networks:
ivatar-network:
driver: bridge

View File

@@ -1,4 +1,10 @@
#!/bin/ash
# Activate the virtual environment
source .virtualenv/bin/activate
# Run Django migrations
./manage.py migrate
# Start the Django development server
exec ./manage.py runserver 0:8080