fix: static file serving in production Docker container

This commit is contained in:
courtmanr@gmail.com
2025-03-10 11:21:43 +00:00
parent c7be5bb1a0
commit 0bdbbc6258
6 changed files with 11 additions and 10 deletions
+5
View File
@@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
## [1.4.1] - 2024-03-15
### Fixed
- Fixed static file serving in production Docker container
## [1.4.0] - 2024-03-15
### Added
+2 -7
View File
@@ -37,7 +37,7 @@ RUN cd frontend && npm run build
FROM node:18-slim
# Add version labels
LABEL version="1.4.0"
LABEL version="1.4.1"
LABEL description="Pulse - A lightweight monitoring application for Proxmox VE"
LABEL maintainer="Richard Courtman"
@@ -65,17 +65,12 @@ COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/frontend/dist ./frontend/dist
# Create a symbolic link from /app/dist/public to /app/frontend/dist
RUN mkdir -p /app/dist/public && rm -rf /app/dist/public && ln -s /app/frontend/dist /app/dist/public
# Install only production dependencies
RUN npm ci --only=production
# Create logs directory with proper permissions
RUN mkdir -p /app/logs && chown -R pulse:pulse /app/logs
# Set environment variables
ENV PORT=7654
ENV NODE_ENV=production
# Switch to non-root user
USER pulse
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pulse-frontend",
"version": "1.4.0",
"version": "1.4.1",
"main": "index.js",
"scripts": {
"dev": "vite",
+1 -1
View File
@@ -1,4 +1,4 @@
// This file contains the version information for the application
// It is automatically updated when a new release is created
export const VERSION = '1.4.0';
export const VERSION = '1.4.1';
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pulse",
"version": "1.4.0",
"version": "1.4.1",
"main": "dist/server.js",
"scripts": {
"start": "node dist/server.js",
+1
View File
@@ -31,6 +31,7 @@ if (config.enableDevTools) {
// Static files - only in production mode
if (config.nodeEnv === 'production') {
// Serve static files from the frontend dist directory
app.use(express.static(path.join(__dirname, '..', 'frontend', 'dist')));
// Serve index.html for all other routes in production