Initial commit
This commit is contained in:
53
Dockerfile
Normal file
53
Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
||||
# Multi-stage build for optimized production image
|
||||
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
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the Angular application
|
||||
RUN npm run build -- --configuration production
|
||||
|
||||
# Production stage
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
# Install curl for health checks
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Copy built application
|
||||
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 && \
|
||||
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
|
||||
|
||||
# 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"
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:80/ || exit 1
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user