flask and node.js solution

This commit is contained in:
cpu
2025-03-26 19:12:43 +01:00
parent 102d2e2748
commit 9b4bf1e255
13 changed files with 1445 additions and 515 deletions

View File

@@ -1,26 +1,23 @@
FROM python:3.11-slim
# Use an official Node.js runtime as a parent image
# Alpine Linux is chosen for its small size
FROM node:20-alpine
# Set working directory
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Copy package.json and package-lock.json (if available)
COPY package*.json ./
# Copy requirements file
COPY requirements.txt .
# Install app dependencies using npm ci for faster, reliable builds
# Use --only=production to avoid installing devDependencies
RUN npm ci --only=production
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
# Copy the rest of the application code
COPY . .
# Generate VAPID keys if .env doesn't exist
RUN if [ ! -f .env ]; then python generate_vapid_keys.py; fi
# Make port 3000 available to the world outside this container
# This is the port our Node.js app will listen on
EXPOSE 3000
# Expose the application port
EXPOSE 8080
# Command to run the application
CMD ["python", "app.py"]
# Define the command to run your app using CMD which defines your runtime
CMD [ "node", "server.js" ]