@xtr-dev/rondevu-server 0.5.18 → 0.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/docker-publish.yml +58 -0
- package/Dockerfile +21 -10
- package/build.js +10 -6
- package/dist/index.js +3 -2
- package/dist/index.js.map +2 -2
- package/migrations/fresh_schema.sql +4 -4
- package/package.json +1 -1
- package/src/rpc.ts +28 -1
- package/src/storage/d1.ts +26 -4
- package/src/storage/memory.ts +26 -0
- package/src/storage/mysql.ts +22 -0
- package/src/storage/postgres.ts +22 -0
- package/src/storage/sqlite.ts +24 -0
- package/src/storage/types.ts +7 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Build and Publish Docker Image
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
tags: ['v*']
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
REGISTRY: ghcr.io
|
|
12
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build-and-push:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
packages: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Docker Buildx
|
|
26
|
+
uses: docker/setup-buildx-action@v3
|
|
27
|
+
|
|
28
|
+
- name: Log in to Container Registry
|
|
29
|
+
if: github.event_name != 'pull_request'
|
|
30
|
+
uses: docker/login-action@v3
|
|
31
|
+
with:
|
|
32
|
+
registry: ${{ env.REGISTRY }}
|
|
33
|
+
username: ${{ github.actor }}
|
|
34
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
35
|
+
|
|
36
|
+
- name: Extract metadata for Docker
|
|
37
|
+
id: meta
|
|
38
|
+
uses: docker/metadata-action@v5
|
|
39
|
+
with:
|
|
40
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
41
|
+
tags: |
|
|
42
|
+
type=ref,event=branch
|
|
43
|
+
type=ref,event=pr
|
|
44
|
+
type=semver,pattern={{version}}
|
|
45
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
46
|
+
type=sha,prefix=
|
|
47
|
+
|
|
48
|
+
- name: Build and push Docker image
|
|
49
|
+
uses: docker/build-push-action@v5
|
|
50
|
+
with:
|
|
51
|
+
context: .
|
|
52
|
+
push: ${{ github.event_name != 'pull_request' }}
|
|
53
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
54
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
55
|
+
build-args: |
|
|
56
|
+
VERSION=${{ github.sha }}
|
|
57
|
+
cache-from: type=gha
|
|
58
|
+
cache-to: type=gha,mode=max
|
package/Dockerfile
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# Build stage
|
|
2
2
|
FROM node:20-alpine AS builder
|
|
3
3
|
|
|
4
|
+
# Version is passed as build arg (from git commit hash)
|
|
5
|
+
ARG VERSION=unknown
|
|
6
|
+
|
|
7
|
+
# Install build tools for better-sqlite3
|
|
8
|
+
RUN apk add --no-cache python3 make g++
|
|
9
|
+
|
|
4
10
|
WORKDIR /app
|
|
5
11
|
|
|
6
12
|
# Copy package files
|
|
7
13
|
COPY package*.json ./
|
|
8
14
|
|
|
9
|
-
# Install dependencies
|
|
15
|
+
# Install dependencies (including native modules)
|
|
10
16
|
RUN npm ci
|
|
11
17
|
|
|
12
18
|
# Copy source files
|
|
@@ -14,22 +20,30 @@ COPY tsconfig.json ./
|
|
|
14
20
|
COPY build.js ./
|
|
15
21
|
COPY src ./src
|
|
16
22
|
|
|
17
|
-
# Build TypeScript
|
|
18
|
-
RUN npm run build
|
|
23
|
+
# Build TypeScript with version embedded
|
|
24
|
+
RUN VERSION=$VERSION npm run build
|
|
19
25
|
|
|
20
26
|
# Production stage
|
|
21
27
|
FROM node:20-alpine
|
|
22
28
|
|
|
29
|
+
# Install build tools for better-sqlite3 native module
|
|
30
|
+
RUN apk add --no-cache python3 make g++
|
|
31
|
+
|
|
23
32
|
WORKDIR /app
|
|
24
33
|
|
|
25
|
-
#
|
|
34
|
+
# Copy package files and install production deps
|
|
26
35
|
COPY package*.json ./
|
|
27
36
|
RUN npm ci --omit=dev && \
|
|
28
|
-
npm
|
|
37
|
+
npm rebuild better-sqlite3 && \
|
|
38
|
+
npm cache clean --force && \
|
|
39
|
+
apk del python3 make g++
|
|
29
40
|
|
|
30
41
|
# Copy built files from builder
|
|
31
42
|
COPY --from=builder /app/dist ./dist
|
|
32
43
|
|
|
44
|
+
# Copy migrations for schema setup
|
|
45
|
+
COPY migrations ./migrations
|
|
46
|
+
|
|
33
47
|
# Create data directory for SQLite
|
|
34
48
|
RUN mkdir -p /app/data && \
|
|
35
49
|
chown -R node:node /app
|
|
@@ -39,12 +53,9 @@ USER node
|
|
|
39
53
|
|
|
40
54
|
# Environment variables with defaults
|
|
41
55
|
ENV PORT=3000
|
|
42
|
-
ENV STORAGE_TYPE=
|
|
43
|
-
ENV STORAGE_PATH=/app/data/sessions.db
|
|
44
|
-
ENV SESSION_TIMEOUT=300000
|
|
45
|
-
ENV CODE_CHARS=0123456789
|
|
46
|
-
ENV CODE_LENGTH=9
|
|
56
|
+
ENV STORAGE_TYPE=memory
|
|
47
57
|
ENV CORS_ORIGINS=*
|
|
58
|
+
ENV NODE_ENV=production
|
|
48
59
|
|
|
49
60
|
# Expose port
|
|
50
61
|
EXPOSE 3000
|
package/build.js
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
const esbuild = require('esbuild');
|
|
3
3
|
const { execSync } = require('child_process');
|
|
4
4
|
|
|
5
|
-
// Use
|
|
6
|
-
let version =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
// Use VERSION env var first (for Docker builds), then fall back to git commit hash
|
|
6
|
+
let version = process.env.VERSION;
|
|
7
|
+
if (!version || version === 'unknown') {
|
|
8
|
+
try {
|
|
9
|
+
version = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim();
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.warn('Could not get git commit hash, using "unknown"');
|
|
12
|
+
version = 'unknown';
|
|
13
|
+
}
|
|
11
14
|
}
|
|
15
|
+
console.log(`Building with version: ${version}`);
|
|
12
16
|
|
|
13
17
|
esbuild.build({
|
|
14
18
|
entryPoints: ['src/index.ts'],
|
package/dist/index.js
CHANGED
|
@@ -2556,7 +2556,8 @@ var handlers = {
|
|
|
2556
2556
|
offerId: offer.id,
|
|
2557
2557
|
answererPublicKey: offer.answererPublicKey,
|
|
2558
2558
|
sdp: offer.answerSdp,
|
|
2559
|
-
answeredAt: offer.answeredAt
|
|
2559
|
+
answeredAt: offer.answeredAt,
|
|
2560
|
+
matchedTags: offer.matchedTags
|
|
2560
2561
|
})),
|
|
2561
2562
|
iceCandidates: iceCandidatesByOffer
|
|
2562
2563
|
};
|
|
@@ -2897,7 +2898,7 @@ function createApp(storage, config) {
|
|
|
2897
2898
|
}
|
|
2898
2899
|
|
|
2899
2900
|
// src/config.ts
|
|
2900
|
-
var BUILD_VERSION = true ? "
|
|
2901
|
+
var BUILD_VERSION = true ? "aa71918" : "unknown";
|
|
2901
2902
|
function loadConfig() {
|
|
2902
2903
|
function parsePositiveInt(value, defaultValue, name, min = 1) {
|
|
2903
2904
|
const parsed = parseInt(value || defaultValue, 10);
|