Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- Dockerfile +4 -8
- startup.bat +7 -4
- startup.sh +7 -4
Dockerfile
CHANGED
|
@@ -29,7 +29,7 @@ COPY server/package*.json ./
|
|
| 29 |
RUN npm install --only=production
|
| 30 |
|
| 31 |
# Copy server source
|
| 32 |
-
COPY server/ ./
|
| 33 |
|
| 34 |
# Production image
|
| 35 |
FROM node:18-alpine
|
|
@@ -40,14 +40,14 @@ RUN apk add --no-cache nginx
|
|
| 40 |
# Create app directory
|
| 41 |
WORKDIR /app
|
| 42 |
|
| 43 |
-
# Copy server
|
| 44 |
-
COPY --from=server-builder /app ./
|
| 45 |
|
| 46 |
# Copy client build to nginx
|
| 47 |
COPY --from=client-builder /app/dist /usr/share/nginx/html
|
| 48 |
|
| 49 |
# Copy nginx configuration
|
| 50 |
-
COPY client/nginx.conf /etc/nginx/
|
| 51 |
|
| 52 |
# Copy startup script
|
| 53 |
COPY startup.sh .
|
|
@@ -58,9 +58,5 @@ RUN chmod +x startup.sh
|
|
| 58 |
# Expose ports
|
| 59 |
EXPOSE 80 3001
|
| 60 |
|
| 61 |
-
# Health check
|
| 62 |
-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 63 |
-
CMD curl -f http://localhost/health || exit 1
|
| 64 |
-
|
| 65 |
# Start both nginx and node server
|
| 66 |
CMD ["./startup.sh"]
|
|
|
|
| 29 |
RUN npm install --only=production
|
| 30 |
|
| 31 |
# Copy server source
|
| 32 |
+
COPY server/ ./server/
|
| 33 |
|
| 34 |
# Production image
|
| 35 |
FROM node:18-alpine
|
|
|
|
| 40 |
# Create app directory
|
| 41 |
WORKDIR /app
|
| 42 |
|
| 43 |
+
# Copy server files
|
| 44 |
+
COPY --from=server-builder /app/server ./
|
| 45 |
|
| 46 |
# Copy client build to nginx
|
| 47 |
COPY --from=client-builder /app/dist /usr/share/nginx/html
|
| 48 |
|
| 49 |
# Copy nginx configuration
|
| 50 |
+
COPY client/nginx.conf /etc/nginx/http.d/default.conf
|
| 51 |
|
| 52 |
# Copy startup script
|
| 53 |
COPY startup.sh .
|
|
|
|
| 58 |
# Expose ports
|
| 59 |
EXPOSE 80 3001
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
# Start both nginx and node server
|
| 62 |
CMD ["./startup.sh"]
|
startup.bat
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
@echo off
|
| 2 |
-
REM Start
|
| 3 |
-
start
|
| 4 |
|
| 5 |
-
REM
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
@echo off
|
| 2 |
+
REM Start the Node.js server in the background
|
| 3 |
+
start node index.js
|
| 4 |
|
| 5 |
+
REM Give the server a moment to start
|
| 6 |
+
timeout /t 3 /nobreak >nul
|
| 7 |
+
|
| 8 |
+
REM Start nginx in the foreground
|
| 9 |
+
nginx -g "daemon off;"
|
startup.sh
CHANGED
|
@@ -1,7 +1,10 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
-
# Start
|
| 4 |
-
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
+
# Start the Node.js server in the background
|
| 4 |
+
node index.js &
|
| 5 |
|
| 6 |
+
# Give the server a moment to start
|
| 7 |
+
sleep 3
|
| 8 |
+
|
| 9 |
+
# Start nginx in the foreground
|
| 10 |
+
nginx -g "daemon off;"
|