version update
This commit is contained in:
40
Dockerfile
40
Dockerfile
@@ -1,4 +1,4 @@
|
||||
# Multi-stage build for optimized production image
|
||||
# Multi-stage build for Docker Registry Browser with Node.js proxy
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
# Set working directory
|
||||
@@ -14,41 +14,43 @@ COPY . .
|
||||
# Build the Angular application
|
||||
RUN npm run build -- --configuration production
|
||||
|
||||
# Production stage
|
||||
FROM nginx:1.25-alpine
|
||||
# Production stage with Node.js proxy server
|
||||
FROM node:18-alpine
|
||||
|
||||
# Install curl for health checks
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install production dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm ci --only=production --silent
|
||||
|
||||
# Copy built application
|
||||
COPY --from=build /app/dist/docker-registry-browser /usr/share/nginx/html
|
||||
COPY --from=build /app/dist ./dist
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy entrypoint script
|
||||
# Copy server and entrypoint
|
||||
COPY server.js ./
|
||||
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 && \
|
||||
chmod -R 755 /usr/share/nginx/html
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1001 -S appuser && \
|
||||
adduser -S -D -H -u 1001 -h /app -s /sbin/nologin -G appuser appuser && \
|
||||
chown -R appuser:appuser /app
|
||||
|
||||
# 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.0.0"
|
||||
LABEL description="Docker Registry Browser with Node.js proxy - A web interface for browsing Docker registries"
|
||||
LABEL version="1.1.0"
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:80/ || exit 1
|
||||
CMD curl -f http://localhost:80/health || exit 1
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Use custom entrypoint to generate environment config (run as root for file creation)
|
||||
# Use Node.js proxy entrypoint
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user