Compare commits
9 Commits
3e127afbae
...
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| b8e7570dc0 | |||
| 624dc336a0 | |||
| 8eb97b4598 | |||
| 186b5840a4 | |||
| 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 }}
|
||||
+9
-6
@@ -1,6 +1,7 @@
|
||||
# ── Stage 1: deps ─────────────────────────────────────────────────────────────
|
||||
FROM node:24-alpine3.21 AS deps
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache python3 make g++
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
@@ -19,20 +20,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,25 @@
|
||||
#!/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
|
||||
existing_group=$(getent group "$PGID" | cut -d: -f1)
|
||||
if [ -n "$existing_group" ] && [ "$existing_group" != "nodejs" ]; then
|
||||
groupmod -g "$((PGID + 50000))" "$existing_group"
|
||||
fi
|
||||
groupmod -g "$PGID" nodejs
|
||||
fi
|
||||
if [ "$PUID" != "1001" ]; then
|
||||
existing_user=$(getent passwd "$PUID" | cut -d: -f1)
|
||||
if [ -n "$existing_user" ] && [ "$existing_user" != "nextjs" ]; then
|
||||
usermod -u "$((PUID + 50000))" "$existing_user"
|
||||
fi
|
||||
usermod -u "$PUID" nextjs
|
||||
fi
|
||||
|
||||
chown -R nextjs:nodejs /data
|
||||
|
||||
exec su-exec nextjs "$@"
|
||||
Generated
+39
-5
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "tally-counter",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tally-counter",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.1",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
@@ -348,9 +348,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
|
||||
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
@@ -2222,6 +2222,40 @@
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@unrs/resolver-binding-win32-arm64-msvc": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz",
|
||||
|
||||
+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