Update for documentation and config of repo location
This commit is contained in:
25
Dockerfile
25
Dockerfile
@@ -1,12 +1,12 @@
|
||||
# Multi-stage build for optimized production image
|
||||
FROM node:18-alpine as build
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm ci --only=production --silent
|
||||
RUN npm ci --silent
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
@@ -26,21 +26,22 @@ COPY --from=build /app/dist/docker-registry-browser /usr/share/nginx/html
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Create nginx user and set permissions
|
||||
RUN addgroup -g 1001 -S nginx && \
|
||||
adduser -S -D -H -u 1001 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx && \
|
||||
# Copy entrypoint script
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# Create assets directory for env.js and set permissions
|
||||
RUN mkdir -p /usr/share/nginx/html/assets && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
chown -R nginx:nginx /var/cache/nginx && \
|
||||
chown -R nginx:nginx /var/log/nginx && \
|
||||
chown -R nginx:nginx /etc/nginx/conf.d
|
||||
|
||||
# Switch to non-root user
|
||||
USER nginx
|
||||
chown -R nginx:nginx /etc/nginx/conf.d && \
|
||||
chmod -R 755 /usr/share/nginx/html
|
||||
|
||||
# Add labels for better container management
|
||||
LABEL maintainer="Your Name <your.email@example.com>"
|
||||
LABEL description="Docker Registry Browser - A web interface for browsing Docker registries"
|
||||
LABEL version="1.1.0"
|
||||
LABEL version="1.0.0"
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
@@ -49,5 +50,5 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Use custom entrypoint to generate environment config (run as root for file creation)
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user