Skip to content

Commit 99617eb

Browse files
committed
Revert "fix feedbacks of the team"
This reverts commit 66bcc71.
1 parent 66bcc71 commit 99617eb

File tree

5 files changed

+31
-91
lines changed

5 files changed

+31
-91
lines changed

.dockerignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
.git
22
node_modules
3-
server/node_modules
43
client/node_modules
4+
server/node_modules
55
client/dist
66
server/dist
7-
data
87
*.db
98
*.db-wal
109
*.db-shm
11-
*.md
1210
.env
13-
.env.*
14-
.claude
15-
.vscode
16-
.idea
17-
*.log

.github/workflows/deploy.yml

Lines changed: 15 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,31 @@ name: Build and Push
33
on:
44
push:
55
branches: [main]
6-
workflow_dispatch:
7-
8-
env:
9-
REGISTRY: ghcr.io
10-
IMAGE: ghcr.io/lawndlwd/quizz
11-
12-
permissions:
13-
contents: read
14-
packages: write
156

167
jobs:
178
build:
18-
strategy:
19-
matrix:
20-
runner:
21-
- os: ubuntu-24.04
22-
platform: linux/amd64
23-
suffix: amd64
24-
- os: ubuntu-24.04-arm
25-
platform: linux/arm64
26-
suffix: arm64
27-
runs-on: ${{ matrix.runner.os }}
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
2813

2914
steps:
30-
- uses: actions/checkout@v4
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set image name
19+
run: echo "IMAGE=ghcr.io/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]'):latest" >> $GITHUB_ENV
3120

32-
- uses: docker/login-action@v3
21+
- name: Log in to GitHub Container Registry
22+
uses: docker/login-action@v3
3323
with:
34-
registry: ${{ env.REGISTRY }}
24+
registry: ghcr.io
3525
username: ${{ github.actor }}
3626
password: ${{ secrets.GITHUB_TOKEN }}
3727

38-
- uses: docker/setup-buildx-action@v3
39-
40-
- uses: docker/build-push-action@v6
28+
- name: Build and push
29+
uses: docker/build-push-action@v6
4130
with:
4231
context: .
43-
platforms: ${{ matrix.runner.platform }}
4432
push: true
45-
tags: ${{ env.IMAGE }}:${{ github.sha }}-${{ matrix.runner.suffix }}
46-
cache-from: type=gha,scope=quizz-${{ matrix.runner.suffix }}
47-
cache-to: type=gha,mode=max,scope=quizz-${{ matrix.runner.suffix }}
48-
49-
merge:
50-
needs: build
51-
runs-on: ubuntu-24.04
52-
53-
steps:
54-
- uses: docker/login-action@v3
55-
with:
56-
registry: ${{ env.REGISTRY }}
57-
username: ${{ github.actor }}
58-
password: ${{ secrets.GITHUB_TOKEN }}
59-
60-
- name: Create multi-arch manifest
61-
run: |
62-
docker buildx imagetools create \
63-
-t ${{ env.IMAGE }}:latest \
64-
-t ${{ env.IMAGE }}:${{ github.sha }} \
65-
${{ env.IMAGE }}:${{ github.sha }}-amd64 \
66-
${{ env.IMAGE }}:${{ github.sha }}-arm64
33+
tags: ${{ env.IMAGE }}

Dockerfile

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
1-
# ── Base: install deps + compile native modules (sqlite3, bcrypt) ──
2-
FROM node:22-alpine AS base
3-
RUN apk add --no-cache python3 make g++
1+
FROM node:22-slim
2+
43
WORKDIR /app
5-
RUN corepack enable pnpm
64

5+
# Install build dependencies for native modules
6+
RUN apt-get update && \
7+
apt-get install -y python3 make g++ && \
8+
rm -rf /var/lib/apt/lists/*
9+
10+
RUN corepack enable && corepack prepare pnpm@latest --activate
11+
12+
# Copy package files
713
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
814
COPY server/package.json ./server/
915
COPY client/package.json ./client/
1016

11-
RUN pnpm install --frozen-lockfile
12-
1317
COPY . .
1418

15-
# ── Build: compile TypeScript (server + client) ──
16-
FROM base AS build
17-
RUN pnpm build
18-
19-
# ── Production: slim runtime image ──
20-
FROM node:22-alpine AS production
21-
WORKDIR /app
22-
RUN corepack enable pnpm
19+
RUN pnpm install --frozen-lockfile
20+
RUN cd /app/node_modules/.pnpm/sqlite3@5.1.7/node_modules/sqlite3 && npm rebuild --build-from-source
2321

24-
# Copy built output and dependencies
25-
COPY --from=build /app/package.json /app/pnpm-workspace.yaml ./
26-
COPY --from=build /app/server/package.json ./server/
27-
COPY --from=build /app/server/dist ./server/dist
28-
COPY --from=build /app/client/dist ./client/dist
29-
COPY --from=build /app/node_modules ./node_modules
30-
COPY --from=build /app/server/node_modules ./server/node_modules
22+
RUN pnpm build
3123

32-
RUN mkdir -p /data && chown -R node:node /data
24+
EXPOSE 3000
3325

3426
ENV DATA_DIR=/data
35-
USER node
36-
EXPOSE 3000
3727

3828
CMD ["pnpm", "--filter", "server", "start"]

docker-compose.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,12 @@ services:
1212
volumes:
1313
- ./data:/data
1414
- ./avatars:/data/avatars
15-
healthcheck:
16-
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/api/health').then(r=>{if(!r.ok)process.exit(1)})"]
17-
interval: 15s
18-
timeout: 5s
19-
retries: 3
20-
start_period: 30s
2115

2216
caddy:
2317
image: caddy:latest
2418
restart: unless-stopped
2519
depends_on:
26-
app:
27-
condition: service_healthy
20+
- app
2821
ports:
2922
- "80:80"
3023
- "443:443"

server/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ initAvatars();
2424
app.use('/avatars', express.static(avatarsDir));
2525
app.get('/api/avatars', (_req, res) => res.json(listAvatars()));
2626

27-
// ── Health check ─────────────────────────────────────────────────────────────
28-
app.get('/api/health', (_req, res) => res.json({ status: 'ok' }));
29-
3027
app.use('/api/admin', adminRouter);
3128

3229
// In production serve the built React app

0 commit comments

Comments
 (0)