Compare commits
4 Commits
23cdc27ffd
...
1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 00da4d2abc | |||
| 1bc4b0fb50 | |||
| 768359ad62 | |||
| cbb10361df |
48
.gitea/workflows/publish.yaml
Normal file
48
.gitea/workflows/publish.yaml
Normal file
@@ -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 }}
|
||||
19
Dockerfile
19
Dockerfile
@@ -1,39 +1,28 @@
|
||||
# Build frontend in a dedicated stage
|
||||
FROM node:24-slim AS frontend-build
|
||||
FROM node:24-alpine AS frontend-build
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package*.json frontend/package-lock*.json ./
|
||||
RUN npm ci --silent
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Final image: build backend, generate Prisma client, prune dev deps, and include frontend dist
|
||||
FROM node:24-slim AS final
|
||||
# Final runtime image
|
||||
FROM node:24-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# install minimal OS deps
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y openssl
|
||||
|
||||
# copy package manifests and install deps (leverage Docker cache)
|
||||
COPY backend/package*.json backend/package-lock*.json ./backend/
|
||||
RUN cd backend && npm ci --silent
|
||||
|
||||
# copy backend source (schema, migrations, source)
|
||||
COPY backend ./backend
|
||||
|
||||
# generate Prisma client against a harmless temp DB path (does not apply migrations)
|
||||
RUN cd backend && DATABASE_URL="file:./data/sqlite.db" npx prisma generate --schema=./prisma/schema.prisma || true
|
||||
|
||||
# remove devDependencies to slim image
|
||||
RUN cd backend && npm prune --production --silent
|
||||
|
||||
# install prisma CLI into final image so entrypoint can run migrate deploy at runtime
|
||||
RUN cd backend && npm i --no-audit --no-fund prisma --silent || true
|
||||
|
||||
# copy entrypoint (added below) and make executable
|
||||
# copy entrypoint and make executable
|
||||
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Copy built frontend into the expected location: /app/frontend/dist
|
||||
COPY --from=frontend-build /app/frontend/dist ./frontend/dist
|
||||
|
||||
|
||||
16
README.md
Normal file
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
Here is example usage of `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
service
|
||||
tally-counter:
|
||||
image: gitea.kanawave.net/sebastas/tally-counter:latest #this image
|
||||
container_name: tally-counter
|
||||
user: 2000:2000 #uid:gid
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- proxy # traefik proxy network
|
||||
volumes:
|
||||
- ./tally-counter:/data # for persistant storage (db + uploads)
|
||||
```
|
||||
|
||||
Quick and dirty setup!
|
||||
Reference in New Issue
Block a user