Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (44 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (44 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Use the official Node.js runtime as the base image
FROM node:22 AS build
# Set the working directory in the container
WORKDIR /app
# Copy package files for the monorepo
COPY package*.json ./
COPY packages/fossflow-lib/package*.json ./packages/fossflow-lib/
COPY packages/fossflow-app/package*.json ./packages/fossflow-app/
#Update NPM
RUN npm install -g npm@11.5.2
# Install dependencies for the entire workspace
RUN npm install
# Copy the entire monorepo code
COPY . .
# Build the library first, then the app
RUN npm run build:lib && npm run build:app
# Use Node with nginx for production
FROM node:22-alpine
# Install nginx
RUN apk add --no-cache nginx
# Copy backend code
COPY --from=build /app/packages/fossflow-backend /app/packages/fossflow-backend
# Install backend production dependencies at build time, so the container
# starts immediately and works without internet access
RUN cd /app/packages/fossflow-backend \
&& npm install --omit=dev --no-audit --no-fund \
&& npm cache clean --force
# Copy the built React app to Nginx's web server directory
COPY --from=build /app/packages/fossflow-app/build /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/http.d/default.conf
# Copy and set up entrypoint script
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Create data directory for persistent storage
RUN mkdir -p /data/diagrams
# Expose ports
EXPOSE 80 3001
# Environment variables with defaults
ENV ENABLE_SERVER_STORAGE=true
ENV STORAGE_PATH=/data/diagrams
ENV BACKEND_PORT=3001
# Start services
ENTRYPOINT ["/docker-entrypoint.sh"]