-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (39 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
55 lines (39 loc) · 1.37 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
# 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 [email protected]
# 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 web server packages
RUN apk add --no-cache nginx openssl
# Copy backend code
COPY --from=build /app/packages/fossflow-backend /app/packages/fossflow-backend
# 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"]