Compare commits
5 Commits
3e127afbae
..
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 260c8475a4 | |||
| dbbca3c13e | |||
| 1094b2c92b | |||
| 5ad2ad691f | |||
| 21620290e2 |
@@ -0,0 +1,48 @@
|
||||
name: Build and publish Docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.kanawave.net
|
||||
REGISTRY_USERNAME: sebastas
|
||||
IMAGE_NAME: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Permissions are not yet supported in Gitea Actions -> https://github.com/go-gitea/gitea/issues/23642#issuecomment-2119876692
|
||||
# permissions:
|
||||
# contents: read
|
||||
# packages: write
|
||||
# attestations: write
|
||||
# id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push
|
||||
id: push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
# file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
+8
-6
@@ -19,20 +19,22 @@ ENV NODE_ENV=production
|
||||
# DATA_DIR is the single volume mount point for both SQLite and uploads
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
# Create a non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs && \
|
||||
# Create a non-root user with default UID/GID (overridable at runtime via PUID/PGID)
|
||||
RUN apk add --no-cache su-exec shadow && \
|
||||
addgroup --gid 1001 nodejs && \
|
||||
adduser --uid 1001 --ingroup nodejs --disabled-password --gecos "" nextjs && \
|
||||
mkdir -p /data/uploads && chown -R nextjs:nodejs /data
|
||||
|
||||
# Copy standalone build output
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||
|
||||
USER nextjs
|
||||
COPY --chmod=755 entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV PUID=1001
|
||||
ENV PGID=1001
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
@@ -1,3 +1,47 @@
|
||||
# tally-counter
|
||||
|
||||
a tally counter app
|
||||
A self-hosted tally counter web app. Create counters, organise them into groups, track history, and view stats.
|
||||
|
||||
## Features
|
||||
|
||||
- Create, edit, and delete counters with optional photos
|
||||
- Organise counters into groups with drag-and-drop reordering
|
||||
- Per-counter history modal — streak stats, 90-day chart, activity calendar
|
||||
- Global stats page with top counters and 12-month calendar
|
||||
- Counters can't go below 0
|
||||
- Hover-to-prefetch on history modal for instant opens
|
||||
- Fully persistent via SQLite (better-sqlite3, WAL mode)
|
||||
|
||||
## Tech stack
|
||||
|
||||
- **Next.js 16** — App Router, TypeScript, standalone output
|
||||
- **Tailwind CSS v4** — Catppuccin Mocha theme
|
||||
- **better-sqlite3** — embedded SQLite, no external database needed
|
||||
- **@dnd-kit** — drag-and-drop for counters and groups
|
||||
|
||||
## Running locally
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
Data is stored in `.data/` (SQLite DB + uploaded images).
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker build -t tally-counter .
|
||||
docker run -p 3000:3000 -v tally_data:/data tally-counter
|
||||
```
|
||||
|
||||
The `/data` volume holds both the database and uploaded images. Mount it to persist data across container restarts.
|
||||
|
||||
## Environment variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|------------|----------------------|------------------------------------|
|
||||
| `DATA_DIR` | `.data` (dev) / `/data` (Docker) | Directory for SQLite DB and uploads |
|
||||
| `PORT` | `3000` | HTTP port |
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@ services:
|
||||
volumes:
|
||||
- app_data:/data
|
||||
environment:
|
||||
- DATA_DIR=/data
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
PUID=${PUID:-1001}
|
||||
PGID=${PGID:-1001}
|
||||
|
||||
# Only remap if the requested IDs differ from the defaults baked into the image
|
||||
if [ "$PGID" != "1001" ]; then
|
||||
groupmod -g "$PGID" nodejs
|
||||
fi
|
||||
if [ "$PUID" != "1001" ]; then
|
||||
usermod -u "$PUID" nextjs
|
||||
fi
|
||||
|
||||
chown -R nextjs:nodejs /data
|
||||
|
||||
exec su-exec nextjs "$@"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tally-counter",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
Reference in New Issue
Block a user