stronghold/Dockerfile
robojerk 8d2def360e Extract YAML validation to separate module
- Created yaml-validator.js with pure validation functions
- Removed redundant checkYAMLFormatting function (rely on js-yaml)
- Fixed function shadowing issues by using window._validateYAMLPure
- Updated nginx config to serve JS files with correct MIME type
- Improved error reporting with line/column numbers from js-yaml
2025-10-31 13:28:38 -07:00

77 lines
1.9 KiB
Docker

FROM python:3.11-slim
# Install nginx
RUN apt-get update && apt-get install -y nginx supervisor && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Create data directory
RUN mkdir -p /app/data && chmod 777 /app/data
# Copy backend requirements and install
COPY backend/requirements.txt /app/backend/
RUN pip install --no-cache-dir -r backend/requirements.txt
# Copy backend code
COPY backend/ /app/backend/
# Copy frontend files
COPY index.html manage.html yaml-validator.js /usr/share/nginx/html/
# Configure nginx
RUN echo 'server {\n\
listen 80;\n\
server_name localhost;\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
\n\
# Serve JavaScript files with correct MIME type (must come before location /)\n\
location ~* \\.js$ {\n\
default_type application/javascript;\n\
try_files $uri =404;\n\
}\n\
\n\
location /api {\n\
proxy_pass http://127.0.0.1:8000;\n\
proxy_set_header Host $host;\n\
proxy_set_header X-Real-IP $remote_addr;\n\
}\n\
\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
}\n\
}' > /etc/nginx/sites-available/default
# Configure supervisor
RUN echo '[supervisord]\n\
nodaemon=true\n\
logfile=/dev/stdout\n\
logfile_maxbytes=0\n\
pidfile=/var/run/supervisord.pid\n\
\n\
[program:nginx]\n\
command=nginx -g "daemon off;"\n\
autostart=true\n\
autorestart=true\n\
stdout_logfile=/dev/stdout\n\
stdout_logfile_maxbytes=0\n\
stderr_logfile=/dev/stderr\n\
stderr_logfile_maxbytes=0\n\
\n\
[program:fastapi]\n\
command=uvicorn backend.main:app --host 127.0.0.1 --port 8000\n\
directory=/app\n\
environment=PYTHONPATH=/app\n\
autostart=true\n\
autorestart=true\n\
stdout_logfile=/dev/stdout\n\
stdout_logfile_maxbytes=0\n\
stderr_logfile=/dev/stderr\n\
stderr_logfile_maxbytes=0\n\
' > /etc/supervisor/conf.d/supervisord.conf
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]