sync for dev 033026
This commit is contained in:
91
files/docker/Dockerfile
Normal file
91
files/docker/Dockerfile
Normal file
@ -0,0 +1,91 @@
|
||||
# ------------------------------------------------------------------
|
||||
# 1. Base image
|
||||
# ------------------------------------------------------------------
|
||||
# We use a slim Debian base so we can use apt‑get to pull every
|
||||
# component in one go. Debian Bookworm contains all the
|
||||
# packages we need (nodejs 18, redis, nginx, php8‑fpm, etc.).
|
||||
# ------------------------------------------------------------------
|
||||
FROM php:8.0-apache
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 2. Build arguments – handy if you want to change the port numbers
|
||||
# without touching the Dockerfile
|
||||
# ------------------------------------------------------------------
|
||||
ARG REDIS_PORT=6379
|
||||
ARG NODE_PORT=3000
|
||||
ARG PHP_PORT=8080
|
||||
ARG NGX_PORT=80
|
||||
|
||||
ENV REDIS_PORT=${REDIS_PORT}
|
||||
ENV NODE_PORT=${NODE_PORT}
|
||||
ENV PHP_PORT=${PHP_PORT}
|
||||
ENV NGX_PORT=${NGX_PORT}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 3. Install all the system packages we need
|
||||
# ------------------------------------------------------------------
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
curl gnupg ca-certificates \
|
||||
nodejs npm \
|
||||
redis-server \
|
||||
nginx \
|
||||
supervisor \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 4. Prepare the working directories
|
||||
# ------------------------------------------------------------------
|
||||
# Node app
|
||||
WORKDIR /app
|
||||
COPY web/node_server/package.json ./
|
||||
RUN npm install
|
||||
COPY web/node_server/ ./
|
||||
|
||||
# Web‑dashboard static files
|
||||
COPY web/html /var/www/html/
|
||||
|
||||
# API settings file
|
||||
COPY cosmostat_settings.yaml /app/cosmostat_settings.yaml
|
||||
|
||||
# Nginx config – you can keep the same file you used for the
|
||||
# proxy service in the compose file. It will proxy 3000 (WS)
|
||||
# and 8080 (PHP) to the local container.
|
||||
COPY web/proxy/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 5. Supervisord configuration
|
||||
# ------------------------------------------------------------------
|
||||
# Create a minimal supervisord.conf that will launch the four
|
||||
# services from the same container.
|
||||
RUN mkdir -p /etc/supervisor/conf.d && \
|
||||
cat > /etc/supervisor/conf.d/supervisord.conf <<EOF
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:redis]
|
||||
command=/usr/bin/redis-server --port ${REDIS_PORT}
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:node]
|
||||
command=npm run start
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g 'daemon off;'
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
EOF
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 6. Expose the ports
|
||||
# ------------------------------------------------------------------
|
||||
EXPOSE ${REDIS_PORT} ${NGX_PORT}
|
||||
|
||||
# 7. Default command – start supervisord
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
Reference in New Issue
Block a user