fix: docker build process and compose environment variables

This commit is contained in:
2026-04-28 23:42:26 +02:00
parent 316b7defb8
commit 28c41042eb
5 changed files with 11 additions and 4 deletions

View File

@@ -14,7 +14,8 @@ COPY backend/Cargo.toml backend/Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release && rm -rf src
COPY backend/src ./src
COPY backend/migrations ./migrations
RUN cargo build --release
# Ensure we actually rebuild the binary with the real source
RUN touch src/main.rs && cargo build --release
# --- Final Image ---
FROM debian:bookworm-slim
@@ -25,5 +26,6 @@ COPY --from=frontend-builder /app/frontend/build ./frontend/build
ENV STATIC_DIR=/app/frontend/build
ENV DATABASE_URL=sqlite:/data/attendance.db
ENV JWT_SECRET=change-me-at-runtime
EXPOSE 3000
CMD ["./server"]

View File

@@ -33,6 +33,12 @@ TutorTool is a full-stack web application for tracking student attendance in tut
- Node.js & npm
- SQLite
### Demo Credentials
- **Admin**: `admin@tutortool.com` / `admin`
### Environment-specific Fixes
- **btrfs pnpm fix**: Use `--package-import-method copy` when running pnpm.
### Key Commands
- `make dev`: Starts both backend and frontend in parallel (requires `JWT_SECRET` and `DATABASE_URL` in environment).
- `make build`: Performs a full production build (frontend first, then backend).

View File

@@ -22,4 +22,4 @@ compose-up:
seed-demo:
@echo "Seeding demo data..."
sqlite3 $${DATABASE_URL#sqlite:} < backend/migrations/demo_seed.sql
sqlite3 $${DATABASE_URL#sqlite:} < backend/demo/demo_seed.sql

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
app:
build: .
@@ -10,4 +8,5 @@ services:
environment:
- DATABASE_URL=sqlite:/data/attendance.db
- STATIC_DIR=/app/frontend/build
- JWT_SECRET=${JWT_SECRET:-dev_secret_for_demo}
restart: always