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 python:3.11-slim
|
||||||
FROM node:18-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package*.json ./
|
# Install Python deps
|
||||||
RUN npm install
|
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
|
EXPOSE 8765
|
||||||
FROM nginx:alpine
|
|
||||||
|
|
||||||
# Copy the Node.js server from the builder stage
|
CMD ["python3", "server.py"]
|
||||||
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;'"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user