Add docker
This commit is contained in:
1 parent
f1dc11111d
commit
dddd68ccf3
4 files changed
+129
No files matched your search
+51
@@ -0,0 +1,51 @@
|
||||
# Multi-stage Dockerfile for flog
|
||||
# Build: deps -> build -> runtime
|
||||
|
||||
# Stage 1: Dependencies
|
||||
FROM node:20-slim AS deps
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Stage 2: Build
|
||||
FROM node:20-slim AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy dependencies
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Set environment for CRA build (avoid treating warnings as errors)
|
||||
ENV CI=false
|
||||
|
||||
# Build client and server
|
||||
RUN npm run build
|
||||
|
||||
# Prune dev dependencies
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
# Stage 3: Runtime
|
||||
FROM node:20-slim AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built assets and runtime files
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=build /app/build ./build
|
||||
COPY --from=build /app/package.json ./package.json
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY config.json ./config.json
|
||||
COPY index.js ./index.js
|
||||
COPY index.ts ./index.ts
|
||||
|
||||
# Create data directory
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3010
|
||||
|
||||
# Run the server
|
||||
CMD ["node", "dist/index.js"]
|
||||
Reference in new issue
Block a user