chore: update Dockerfile to use Supervisor and improve static file organization
This commit is contained in:
parent
b9d5e29207
commit
ff0799603a
37
Dockerfile
37
Dockerfile
@ -38,22 +38,27 @@ RUN htpasswd -cb /etc/nginx/.htpasswd ${AUTH_USERNAME} ${AUTH_PASSWORD} \
|
||||
&& chown nginx:nginx /etc/nginx/.htpasswd \
|
||||
&& chmod 600 /etc/nginx/.htpasswd
|
||||
|
||||
# Copy application files
|
||||
COPY --from=builder /app/data-api.js \
|
||||
/usr/share/nginx/html/data-api.js \
|
||||
/usr/share/nginx/html/auth-middleware.js \
|
||||
/usr/share/nginx/html/backup-s3.js \
|
||||
/usr/share/nginx/html/package.json \
|
||||
/usr/share/nginx/html/package-lock.json \
|
||||
/usr/share/nginx/html/node_modules \
|
||||
/usr/share/nginx/html/.git \
|
||||
/usr/share/nginx/html/.github \
|
||||
/usr/share/nginx/html/.vscode \
|
||||
/usr/share/nginx/html/README.md
|
||||
# Copy Supervisor configuration
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Expose port 80 for HTTP traffic
|
||||
# Copy static website content (HTML, CSS, JS for the frontend)
|
||||
COPY index.html /usr/share/nginx/html/
|
||||
COPY js/ /usr/share/nginx/html/js/
|
||||
COPY css/ /usr/share/nginx/html/css/
|
||||
# Add other static asset directories if they exist (e.g., images, fonts, libs)
|
||||
# COPY images/ /usr/share/nginx/html/images/
|
||||
|
||||
# Create app directory for Node.js API and copy from builder stage
|
||||
WORKDIR /app # Make sure this WORKDIR is set before copying to /app
|
||||
COPY --from=builder /app .
|
||||
|
||||
# Create data directory (volume will be mounted here by docker-compose)
|
||||
# Ensure Nginx (and Node.js if it needs to write logs/pid here) has permissions
|
||||
RUN mkdir -p /data && chown nginx:nginx /data # Or appropriate user for Node.js if it writes here
|
||||
VOLUME /data
|
||||
|
||||
# Expose port 80 for Nginx (which handles auth and proxies to API)
|
||||
EXPOSE 80
|
||||
|
||||
# Command to start Nginx in the foreground
|
||||
# This ensures the container keeps running
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Start Supervisor when the container launches
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user