first commit

This commit is contained in:
Vadim Sobinin
2026-02-02 16:14:57 +03:00
commit fc886320e3
48 changed files with 5569 additions and 0 deletions

46
Dockerfile Normal file
View File

@@ -0,0 +1,46 @@
# Stage 1: Build frontend
FROM node:22-alpine AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/yarn.lock* ./
RUN yarn install --frozen-lockfile || yarn install
COPY frontend/ ./
RUN yarn build
# Stage 2: Build backend
FROM node:22-alpine AS backend-builder
WORKDIR /app/backend
COPY backend/package.json backend/yarn.lock* ./
RUN yarn install --frozen-lockfile || yarn install
COPY backend/ ./
RUN yarn db:generate && yarn build
# Stage 3: Production
FROM node:22-alpine AS production
WORKDIR /app
# Install production dependencies only
COPY backend/package.json backend/yarn.lock* ./
RUN yarn install --production --frozen-lockfile || yarn install --production
# Copy Prisma schema and generate client
COPY backend/prisma ./prisma
RUN npx prisma generate
# Copy built backend
COPY --from=backend-builder /app/backend/dist ./dist
# Copy built frontend
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
# Create data directory for SQLite
RUN mkdir -p /app/data
ENV NODE_ENV=production
ENV DATABASE_URL="file:/app/data/timetracker.db"
ENV STATIC_ROOT="/app/frontend/dist"
ENV PORT=3000
EXPOSE 3000
# Initialize database and start server
CMD npx prisma db push --skip-generate && node dist/index.js