diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ea1f77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Runtime data +data/ +certs/ + +# Environment files +.env + +# OS files +.DS_Store +Thumbs.db + +# Editor directories and files +.idea +.vscode +*.swp +*.swo + +# Logs +*.log +logs/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f993cbd..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM registry:2 - -# Install Apache utilities for htpasswd management -RUN apt-get update && apt-get install -y \ - apache2-utils \ - && rm -rf /var/lib/apt/lists/* - -# Create auth directory -RUN mkdir -p /etc/docker/registry/auth - -# Copy custom entrypoint script -COPY entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/entrypoint.sh - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] -CMD ["/etc/docker/registry/config.yml"] \ No newline at end of file diff --git a/config.yml b/config.yml deleted file mode 100644 index 3003e55..0000000 --- a/config.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 0.1 -log: - fields: - service: registry -storage: - cache: - blobdescriptor: inmemory - filesystem: - rootdirectory: /var/lib/registry -http: - addr: :5000 - headers: - X-Content-Type-Options: [nosniff] -auth: - htpasswd: - realm: basic-realm - path: /etc/docker/registry/auth/htpasswd -health: - storagedriver: - enabled: true - interval: 10s - threshold: 3 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fc7ec97..0da0ca7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,38 +2,13 @@ version: '3.8' services: registry: - build: . + image: registry:2 container_name: registry restart: unless-stopped expose: - "5000" volumes: - registry-data:/var/lib/registry - - registry-auth:/etc/docker/registry/auth - - ./config.yml:/etc/docker/registry/config.yml - networks: - - registry-network - - registry-ui: - image: joxit/docker-registry-ui:latest - container_name: registry-ui - restart: unless-stopped - expose: - - "80" - environment: - - SINGLE_REGISTRY=${SINGLE_REGISTRY:-true} - - REGISTRY_TITLE=${REGISTRY_TITLE:-Docker Registry} - - DELETE_IMAGES=${DELETE_IMAGES:-true} - - SHOW_CONTENT_DIGEST=${SHOW_CONTENT_DIGEST:-true} - - NGINX_PROXY_PASS_URL=${REGISTRY_URL:-http://registry:5000} - - SHOW_CATALOG_NB_TAGS=${SHOW_CATALOG_NB_TAGS:-true} - - CATALOG_MIN_BRANCHES=${CATALOG_MIN_BRANCHES:-1} - - CATALOG_MAX_BRANCHES=${CATALOG_MAX_BRANCHES:-1} - - TAGLIST_PAGE_SIZE=${TAGLIST_PAGE_SIZE:-100} - - REGISTRY_SECURED=${REGISTRY_SECURED:-true} - - CATALOG_ELEMENTS_LIMIT=${CATALOG_ELEMENTS_LIMIT:-1000} - depends_on: - - registry networks: - registry-network @@ -43,6 +18,4 @@ networks: volumes: registry-data: - driver: local - registry-auth: driver: local \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index 6ef373a..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# Initialize auth file if it doesn't exist -if [ ! -f /etc/docker/registry/auth/htpasswd ]; then - echo "Initializing auth file with default user 'recruas'" - htpasswd -B -c /etc/docker/registry/auth/htpasswd recruas - echo "Auth file created. Default user: recruas" -fi - -# Start the registry -exec /bin/registry /etc/docker/registry/config.yml "$@" \ No newline at end of file diff --git a/env.example b/env.example new file mode 100644 index 0000000..c3c0cfc --- /dev/null +++ b/env.example @@ -0,0 +1,9 @@ +# Registry Configuration +REGISTRY_STORAGE_PATH=/var/lib/registry + +# Expose settings +REGISTRY_PORT=5000 + +# Optional SSL Configuration +# SSL_CERT_PATH=./certs/domain.crt +# SSL_KEY_PATH=./certs/domain.key \ No newline at end of file diff --git a/setup.sh b/setup.sh deleted file mode 100755 index ead02d0..0000000 --- a/setup.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -echo "Setting up Docker Registry with authentication..." - -# Build and start the registry -docker-compose up -d --build - -echo "Waiting for registry to start..." -sleep 5 - -# Set initial password for recruas user -echo "Setting password for 'recruas' user..." -docker exec -it registry htpasswd -B /etc/docker/registry/auth/htpasswd recruas - -echo "Setup complete!" -echo "Registry is running with authentication enabled." -echo "Default user: recruas" -echo "UI will be available on port 80 (exposed)" -echo "Registry API available on port 5000 (exposed)" -echo "" -echo "To change password later:" -echo "docker exec -it registry htpasswd -B /etc/docker/registry/auth/htpasswd recruas" \ No newline at end of file