initial commit
This commit is contained in:
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
# Stage 1: Build frontend
|
||||
FROM node:22-alpine AS build-frontend
|
||||
WORKDIR /app/frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Build backend
|
||||
FROM node:22-alpine AS build-backend
|
||||
WORKDIR /app/backend
|
||||
COPY backend/package*.json ./
|
||||
RUN npm install
|
||||
COPY backend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# Stage 3: Production
|
||||
FROM node:22-alpine AS production
|
||||
WORKDIR /app
|
||||
|
||||
# Install only production deps for backend
|
||||
COPY backend/package*.json ./backend/
|
||||
RUN cd backend && npm install --omit=dev
|
||||
|
||||
# Copy compiled backend
|
||||
COPY --from=build-backend /app/backend/dist ./backend/dist
|
||||
|
||||
# Copy built frontend into location the backend will serve
|
||||
COPY --from=build-frontend /app/frontend/dist ./frontend/dist
|
||||
|
||||
# Data directory for SQLite
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
CMD ["node", "backend/dist/index.js"]
|
||||
Reference in New Issue
Block a user