rewrite: Dockerfile for Python heartbeat engine — drop Node/Nginx (#548)
Some checks failed
Deploy Nexus / deploy (push) Failing after 3s
Some checks failed
Deploy Nexus / deploy (push) Failing after 3s
This commit is contained in:
37
Dockerfile
37
Dockerfile
@@ -1,35 +1,14 @@
|
||||
# Stage 1: Build the Node.js server
|
||||
FROM node:18-alpine AS builder
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
# Install Python deps
|
||||
COPY nexus/ nexus/
|
||||
COPY server.py .
|
||||
COPY portals.json vision.json ./
|
||||
|
||||
COPY . .
|
||||
RUN pip install --no-cache-dir websockets
|
||||
|
||||
# Stage 2: Create the final Nginx image
|
||||
FROM nginx:alpine
|
||||
EXPOSE 8765
|
||||
|
||||
# Copy the Node.js server from the builder stage
|
||||
COPY --from=builder /app /app
|
||||
|
||||
# Copy the static files
|
||||
COPY . /usr/share/nginx/html
|
||||
RUN rm -f /usr/share/nginx/html/Dockerfile \
|
||||
/usr/share/nginx/html/docker-compose.yml \
|
||||
/usr/share/nginx/html/deploy.sh \
|
||||
/usr/share/nginx/html/server.js \
|
||||
/usr/share/nginx/html/package.json \
|
||||
/usr/share/nginx/html/package-lock.json \
|
||||
/usr/share/nginx/html/node_modules
|
||||
|
||||
# Copy the Nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Expose port 80 for Nginx and 3001 for the Node.js server
|
||||
EXPOSE 80
|
||||
EXPOSE 3001
|
||||
|
||||
# Start both Nginx and the Node.js server
|
||||
CMD ["sh", "-c", "node /app/server.js & nginx -g 'daemon off;'"]
|
||||
CMD ["python3", "server.py"]
|
||||
|
||||
Reference in New Issue
Block a user