Add Docker workflow
Build dev docker image / build (push) Successful in 36s
Build dev docker image / release (push) Has been skipped

This commit is contained in:
2026-03-30 12:41:42 +02:00
parent 8dc1f27b17
commit c54553143e
5 changed files with 110 additions and 12 deletions
+2
View File
@@ -47,6 +47,8 @@ venv.bak/
.git/
.gitignore
.prettierignore
.github/
.gitea/
# Project specific
/static/
+11
View File
@@ -0,0 +1,11 @@
---
name: "Bug"
about: "Report a bug"
title: "[BUG] "
ref: "main"
assignees: ["kennyboy55"]
labels:
- bug
---
Please describe the bug, and add relevant logs.
+74
View File
@@ -0,0 +1,74 @@
name: Build dev docker image
on:
push:
branches:
- dev
- main
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout repository for build
- name: Checkout friend-event-rsvp repository
uses: actions/checkout@v4
with:
ref: ${{ gitea.ref }}
# Login to registry
- name: Gitea package registry login
run: |
echo "${{ secrets.ACCESS_TOKEN }}" | docker login gitea.furb.it \
-u "${{ secrets.USERNAME }}" \
--password-stdin
# Build image
- name: Build Docker image - gitea.furb.it/${{ gitea.repository }}:${{ gitea.ref_name }}
run: |
docker build \
-f Dockerfile \
--label friend-event-rsvp.ref=${{ gitea.ref_name }} \
-t gitea.furb.it/${{ gitea.repository }}:${{ gitea.ref_name }} \
.
- name: Tag Docker image - gitea.furb.it/${{ gitea.repository }}:latest
if: startsWith(gitea.ref, 'refs/tags/')
run: |
docker image tag \
gitea.furb.it/${{ gitea.repository }}:${{ gitea.ref_name }} \
gitea.furb.it/${{ gitea.repository }}:latest
# Push images
- name: Push Docker image
run: |
docker push gitea.furb.it/${{ gitea.repository }}:${{ gitea.ref_name }}
- name: Push Docker image :latest
if: startsWith(gitea.ref, 'refs/tags/')
run: |
docker push gitea.furb.it/${{ gitea.repository }}:latest
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(gitea.ref, 'refs/tags/')
steps:
# Create release using gitea-release-action
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
server: "https://gitea.furb.it"
token: ${{ secrets.ACCESS_TOKEN }}
repository: ${{ gitea.repository }}
tag_name: ${{ gitea.ref_name }}
name: ${{ gitea.ref_name }}
body: |
"## Docker images"
"`gitea.furb.it/${{ gitea.repository }}:${{ gitea.ref_name }}`"
"`gitea.furb.it/${{ gitea.repository }}:latest`"
+2
View File
@@ -1,5 +1,7 @@
FROM python:3.12-alpine3.23
LABEL maintainer="Kenneth van Ewijk (kennyboy55)"
# Add dependencies
#RUN apk add --no-cache postgresql-libs postgresql-client
RUN apk add --no-cache tini
+21 -12
View File
@@ -1,22 +1,27 @@
![Build](https://gitea.furb.it/kennyboy55/friend-event-rsvp/actions/workflows/build-docker.yml/badge.svg)
# friend-event-rsvp
A personal event RSVP tool. Meant for personal home use and a single administrator. Unique feature is multiple activities per event.
# Production
## Production
Make sure there are no deployment issues
`python manage.py check --deploy`
Collect and compress all static files
Collect and compress all static files:
`python manage.py collectstatic --clear` <-- Clear is optional
`python -m blacknoise.compress static/`
Run the server
`daphne rsvpproject.asgi:application`
# Development
## Development
## Setup environment
### Setup environment
Install pipenv: `pip install --user pipenv`
@@ -33,7 +38,7 @@ Requirements (installed from Pipfile):
- Daphne
- BlackNoise
## Publish docker image
### Publish docker image
Build
`docker build -t gitea.furb.it/kennyboy55/friend-event-rsvp:dev .`
@@ -41,19 +46,23 @@ Build
How to tag:
`docker push gitea.furb.it/kennyboy55/friend-event-rsvp:dev`
## Run
### Run
Run the server during development: `DEBUG=1 python manage.py runserver`
This will automatically restart on changes and log to the console.
## Setup database
### Setup database
This needs to be done every time a model chance is made
`python manage.py makemigrations`
`python manage.py migrate`
This needs to be done every time a model chance is made:
## To add a superuser
- Create migrations file (add to repo): `python manage.py makemigrations`
- Update local database: `python manage.py migrate`
### To add a superuser
You will be prompted for a password:
`python manage.py createsuperuser --username <username> --email <email>`
You can use this to login to the django admin environment: `http://127.0.0.1:8000/django-admin/`
`python manage.py createsuperuser --username <username> --email <email>`