WeightTracker/Dockerfile

36 lines
1.4 KiB
Docker

# Use Nginx as the base image for serving static content
FROM nginx:alpine
# Copy the custom Nginx configuration
# This replaces the default Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy all static website files to the Nginx serving directory
# This includes HTML, CSS, JavaScript, images, and the js/dataManager.js for client-side logic
COPY . /usr/share/nginx/html
# Remove unnecessary files and directories from the Nginx serving directory
# This helps to keep the final image size small and clean
RUN rm -rf /usr/share/nginx/html/Dockerfile \
/usr/share/nginx/html/docker-compose.yml \
/usr/share/nginx/html/nginx.conf \
/usr/share/nginx/html/nginx-auth.conf \
/usr/share/nginx/html/supervisord.conf \
/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
# Expose port 80 for HTTP traffic
EXPOSE 80
# Command to start Nginx in the foreground
# This ensures the container keeps running
CMD ["nginx", "-g", "daemon off;"]