Skip to content

Commit 02b5680

Browse files
committed
feat: Configure Nexus Docker registry for image hosting
Updated all configurations to use ACN Nexus Docker registry: - Push registry: docker-push.acn.fr (requires authentication) - Public registry: docker.acn.fr (anonymous pull access) Changes: - Updated Woodpecker CI pipeline to use Nexus registries - Modified Makefile with separate push/pull registry variables - Added 'make login' command for Nexus authentication - Updated docker-compose.prod.yml to use Nexus registry - Enhanced documentation with Nexus-specific instructions - Updated CI_SETUP.md with Nexus authentication details Secrets required: - nexus_username (e.g., admin) - nexus_password (Nexus password)
1 parent 4523392 commit 02b5680

File tree

5 files changed

+115
-58
lines changed

5 files changed

+115
-58
lines changed

.woodpecker.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ steps:
2626
when:
2727
event: [push, tag]
2828
settings:
29-
registry: ${CI_REGISTRY:-docker.io}
30-
repo: ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp
29+
registry: ${CI_REGISTRY:-docker-push.acn.fr}
30+
repo: ${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp
3131
dockerfile: Dockerfile
3232
platforms: linux/amd64,linux/arm64
3333
build_args:
@@ -38,13 +38,13 @@ steps:
3838
- ${CI_COMMIT_BRANCH}
3939
- ${CI_COMMIT_SHA:0:8}
4040
username:
41-
from_secret: docker_username
41+
from_secret: nexus_username
4242
password:
43-
from_secret: docker_password
43+
from_secret: nexus_password
4444
cache_from:
45-
- ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:buildcache
45+
- ${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp:buildcache
4646
cache_to:
47-
- type=registry,ref=${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:buildcache,mode=max
47+
- type=registry,ref=${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp:buildcache,mode=max
4848

4949
# Step 3: Build multi-arch Docker images (slim Debian)
5050
build-docker-slim:
@@ -53,8 +53,8 @@ steps:
5353
when:
5454
event: [push, tag]
5555
settings:
56-
registry: ${CI_REGISTRY:-docker.io}
57-
repo: ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp
56+
registry: ${CI_REGISTRY:-docker-push.acn.fr}
57+
repo: ${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp
5858
dockerfile: Dockerfile.slim
5959
platforms: linux/amd64,linux/arm64
6060
build_args:
@@ -65,53 +65,53 @@ steps:
6565
- ${CI_COMMIT_BRANCH}-slim
6666
- ${CI_COMMIT_SHA:0:8}-slim
6767
username:
68-
from_secret: docker_username
68+
from_secret: nexus_username
6969
password:
70-
from_secret: docker_password
70+
from_secret: nexus_password
7171
cache_from:
72-
- ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:buildcache-slim
72+
- ${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp:buildcache-slim
7373
cache_to:
74-
- type=registry,ref=${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:buildcache-slim,mode=max
74+
- type=registry,ref=${CI_REGISTRY:-docker-push.acn.fr}/openspp/openspp:buildcache-slim,mode=max
7575

7676
# Step 4: Security scan of Docker images
7777
scan-docker:
7878
image: aquasec/trivy:latest
7979
when:
8080
event: [push, tag]
8181
commands:
82-
# Scan Ubuntu image
82+
# Scan Ubuntu image (using public registry URL)
8383
- trivy image --severity HIGH,CRITICAL --exit-code 0
84-
${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}
84+
docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}
8585

8686
# Scan slim image
8787
- trivy image --severity HIGH,CRITICAL --exit-code 0
88-
${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}-slim
88+
docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}-slim
8989

9090
# Generate reports
9191
- trivy image --format json --output trivy-ubuntu.json
92-
${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}
92+
docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}
9393
- trivy image --format json --output trivy-slim.json
94-
${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}-slim
94+
docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}-slim
9595

9696
# Step 5: Test Docker images
9797
test-docker:
9898
image: docker:latest
9999
when:
100100
event: [push, tag]
101101
commands:
102-
# Test Ubuntu image
103-
- docker run --rm ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}
102+
# Test Ubuntu image (using public registry URL)
103+
- docker run --rm docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}
104104
openspp-server --version
105105

106106
# Test slim image
107-
- docker run --rm ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}-slim
107+
- docker run --rm docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}-slim
108108
openspp-server --version
109109

110110
# Test health check endpoint
111111
- |
112112
docker run -d --name test-openspp -p 8069:8069 \
113113
-e SKIP_DB_WAIT=true \
114-
${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_SHA:0:8}
114+
docker.acn.fr/openspp/openspp:${CI_COMMIT_SHA:0:8}
115115
sleep 30
116116
curl -f http://localhost:8069/web/health || exit 1
117117
docker stop test-openspp
@@ -124,16 +124,16 @@ steps:
124124
when:
125125
event: tag
126126
settings:
127-
registry: ${PROD_REGISTRY}
128-
repo: ${PROD_REGISTRY}/${PROD_REPO}/openspp
127+
registry: ${PROD_REGISTRY:-docker-push.acn.fr}
128+
repo: ${PROD_REGISTRY:-docker-push.acn.fr}/openspp/openspp
129129
tags:
130130
- ${CI_COMMIT_TAG}
131131
- latest
132132
- stable
133133
username:
134-
from_secret: prod_docker_username
134+
from_secret: nexus_username
135135
password:
136-
from_secret: prod_docker_password
136+
from_secret: nexus_password
137137
dry_run: false
138138

139139
# Step 7: Update deployment manifests
@@ -145,7 +145,7 @@ steps:
145145
- |
146146
git clone https://github.com/${CI_REPO_OWNER}/openspp-k8s-manifests.git
147147
cd openspp-k8s-manifests
148-
find deployments -name "*.yaml" -exec sed -i "s|image:.*openspp:.*|image: ${CI_REGISTRY:-docker.io}/${CI_REPO_OWNER}/openspp:${CI_COMMIT_TAG}|g" {} \;
148+
find deployments -name "*.yaml" -exec sed -i "s|image:.*openspp:.*|image: docker.acn.fr/openspp/openspp:${CI_COMMIT_TAG}|g" {} \;
149149
git add .
150150
git commit -m "Update OpenSPP image to ${CI_COMMIT_TAG}"
151151
git push

CI_SETUP.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CI/CD Setup Guide for Woodpecker
22

3+
## Docker Registry Configuration
4+
5+
This project uses ACN Nexus Docker Registry:
6+
- **Push Registry:** `docker-push.acn.fr` (requires authentication)
7+
- **Public Registry:** `docker.acn.fr` (anonymous pull access)
8+
39
## Prerequisites
410

511
### Server Configuration
@@ -24,28 +30,24 @@ This can be set in:
2430

2531
The pipeline requires the following secrets to be configured in Woodpecker:
2632

27-
1. **Docker Registry Credentials** (for pushing images):
28-
- `docker_username`: Docker Hub or registry username
29-
- `docker_password`: Docker Hub or registry password/token
30-
31-
2. **Production Registry Credentials** (optional, for production deployments):
32-
- `prod_docker_username`: Production registry username
33-
- `prod_docker_password`: Production registry password/token
33+
1. **Nexus Registry Credentials** (for pushing images):
34+
- `nexus_username`: Nexus username (e.g., `admin`)
35+
- `nexus_password`: Nexus password
3436

35-
3. **Slack Webhook** (optional, for notifications):
37+
2. **Slack Webhook** (optional, for notifications):
3638
- `slack_webhook`: Slack webhook URL for build notifications
3739

3840
### Setting Secrets in Woodpecker
3941

4042
Using the Woodpecker CLI:
4143
```bash
4244
woodpecker secret add -repository openspp/openspp-packaging-docker \
43-
-name docker_username \
44-
-value "your-docker-username"
45+
-name nexus_username \
46+
-value "admin"
4547

4648
woodpecker secret add -repository openspp/openspp-packaging-docker \
47-
-name docker_password \
48-
-value "your-docker-password"
49+
-name nexus_password \
50+
-value "your-nexus-password"
4951
```
5052

5153
Or via the Woodpecker UI:
@@ -80,9 +82,15 @@ If you cannot enable privileged mode on your Woodpecker server, you can use the
8082
### Build fails with "unauthorized"
8183

8284
**Solution**: Check that:
83-
1. Docker credentials secrets are properly configured
85+
1. Nexus credentials secrets are properly configured
8486
2. The credentials have push access to the target repository
85-
3. The registry URL is correct in the pipeline configuration
87+
3. The registry URLs are correct:
88+
- Push: `docker-push.acn.fr`
89+
- Pull: `docker.acn.fr`
90+
4. Test authentication locally:
91+
```bash
92+
docker login docker-push.acn.fr -u admin
93+
```
8694

8795
## Pipeline Workflow
8896

@@ -107,10 +115,17 @@ The pipeline triggers on:
107115
## Environment Variables
108116

109117
The pipeline uses these CI variables (automatically provided by Woodpecker):
110-
- `CI_REGISTRY`: Docker registry URL
118+
- `CI_REGISTRY`: Docker registry URL (defaults to `docker-push.acn.fr`)
111119
- `CI_REPO_OWNER`: Repository owner/organization
112120
- `CI_COMMIT_TAG`: Git tag (for releases)
113121
- `CI_COMMIT_BRANCH`: Git branch name
114122
- `CI_COMMIT_SHA`: Git commit hash
115123
- `CI_BUILD_CREATED`: Build timestamp
116-
- `PROD_REGISTRY`: Production registry URL (optional)
124+
- `PROD_REGISTRY`: Production registry URL (defaults to `docker-push.acn.fr`)
125+
126+
## Registry URLs
127+
128+
- **Push Operations:** `docker-push.acn.fr/openspp/openspp`
129+
- **Public Access:** `docker.acn.fr/openspp/openspp`
130+
131+
Images are automatically available at the public URL after being pushed to the private registry.

Makefile

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
# Variables
77
IMAGE_TAG ?= daily
8-
REGISTRY ?= docker.io
8+
REGISTRY ?= docker.acn.fr
9+
PUSH_REGISTRY ?= docker-push.acn.fr
910
REPO ?= openspp/openspp
1011
IMAGE_NAME = $(REGISTRY)/$(REPO)
12+
PUSH_IMAGE_NAME = $(PUSH_REGISTRY)/$(REPO)
1113
COMPOSE_FILE ?= docker-compose.yml
1214
COMPOSE_PROD_FILE ?= docker-compose.prod.yml
1315

@@ -32,6 +34,8 @@ build: ## Build the standard Ubuntu-based image
3234
--build-arg VCS_REF=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") \
3335
-t $(IMAGE_NAME):$(IMAGE_TAG) \
3436
-t $(IMAGE_NAME):latest \
37+
-t $(PUSH_IMAGE_NAME):$(IMAGE_TAG) \
38+
-t $(PUSH_IMAGE_NAME):latest \
3539
-f Dockerfile .
3640

3741
build-slim: ## Build the lightweight Debian-based image
@@ -42,6 +46,8 @@ build-slim: ## Build the lightweight Debian-based image
4246
--build-arg VCS_REF=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") \
4347
-t $(IMAGE_NAME):$(IMAGE_TAG)-slim \
4448
-t $(IMAGE_NAME):latest-slim \
49+
-t $(PUSH_IMAGE_NAME):$(IMAGE_TAG)-slim \
50+
-t $(PUSH_IMAGE_NAME):latest-slim \
4551
-f Dockerfile.slim .
4652

4753
build-all: build build-slim ## Build both standard and slim images
@@ -144,13 +150,17 @@ backup: ## Backup database and filestore
144150
@docker-compose -f $(COMPOSE_FILE) exec openspp tar -czf - /var/lib/openspp > backups/filestore_$(shell date +%Y%m%d_%H%M%S).tar.gz
145151
@echo "$(GREEN)Backup completed in ./backups/$(NC)"
146152

147-
push: ## Push images to registry
148-
@echo "$(GREEN)Pushing images to $(REGISTRY)...$(NC)"
149-
docker push $(IMAGE_NAME):$(IMAGE_TAG)
150-
docker push $(IMAGE_NAME):latest
151-
docker push $(IMAGE_NAME):$(IMAGE_TAG)-slim
152-
docker push $(IMAGE_NAME):latest-slim
153+
push: ## Push images to Nexus registry
154+
@echo "$(GREEN)Pushing images to $(PUSH_REGISTRY)...$(NC)"
155+
@echo "$(YELLOW)Note: Make sure you're logged in: docker login $(PUSH_REGISTRY)$(NC)"
156+
docker push $(PUSH_IMAGE_NAME):$(IMAGE_TAG)
157+
docker push $(PUSH_IMAGE_NAME):latest
158+
docker push $(PUSH_IMAGE_NAME):$(IMAGE_TAG)-slim
159+
docker push $(PUSH_IMAGE_NAME):latest-slim
153160
@echo "$(GREEN)Images pushed successfully$(NC)"
161+
@echo "$(GREEN)Images available for public access at:$(NC)"
162+
@echo " $(IMAGE_NAME):$(IMAGE_TAG)"
163+
@echo " $(IMAGE_NAME):$(IMAGE_TAG)-slim"
154164

155165
scan: ## Security scan with Trivy
156166
@echo "$(GREEN)Scanning images for vulnerabilities...$(NC)"
@@ -161,9 +171,11 @@ scan: ## Security scan with Trivy
161171
info: ## Show environment information
162172
@echo "$(GREEN)OpenSPP Docker Environment Information$(NC)"
163173
@echo "Image Tag: $(IMAGE_TAG)"
164-
@echo "Registry: $(REGISTRY)"
174+
@echo "Public Registry: $(REGISTRY)"
175+
@echo "Push Registry: $(PUSH_REGISTRY)"
165176
@echo "Repository: $(REPO)"
166-
@echo "Image: $(IMAGE_NAME)"
177+
@echo "Public Image: $(IMAGE_NAME)"
178+
@echo "Push Image: $(PUSH_IMAGE_NAME)"
167179
@echo "APT Repository: https://builds.acn.fr/repository/apt-openspp-daily"
168180
@echo ""
169181
@echo "$(YELLOW)Container Status:$(NC)"
@@ -190,4 +202,9 @@ prod-check: ## Validate production readiness
190202
@echo -n "4. Checking admin password... "
191203
@docker-compose -f $(COMPOSE_FILE) exec openspp grep "admin_passwd" /etc/openspp/odoo.conf | grep -q "admin_passwd = admin" && echo "$(RED)✗ Using default password$(NC)" || echo "$(GREEN)$(NC)"
192204
@echo ""
193-
@echo "$(GREEN)Production check complete$(NC)"
205+
@echo "$(GREEN)Production check complete$(NC)"
206+
207+
login: ## Login to Nexus Docker registry
208+
@echo "$(GREEN)Logging in to Nexus registry: $(PUSH_REGISTRY)$(NC)"
209+
@docker login $(PUSH_REGISTRY)
210+
@echo "$(GREEN)Successfully logged in to $(PUSH_REGISTRY)$(NC)"

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Production-ready Docker images for OpenSPP Social Protection Platform based on O
44

55
> **Note:** This configuration uses OpenSPP daily builds from the [apt-openspp-daily](https://builds.acn.fr/repository/apt-openspp-daily/) repository. The package name is `openspp-17-daily`.
66
7+
## Docker Registry
8+
9+
Images are hosted on ACN Nexus Docker Registry:
10+
- **Public access (pull):** `docker.acn.fr/openspp/openspp`
11+
- **Push access:** `docker-push.acn.fr/openspp/openspp` (requires authentication)
12+
713
## Features
814

915
- 🚀 **Multi-architecture support** (amd64, arm64)
@@ -66,7 +72,7 @@ docker run -d \
6672
-e DB_USER=openspp \
6773
-e DB_PASSWORD=openspp \
6874
-e ODOO_ADMIN_PASSWORD=admin \
69-
openspp/openspp:latest
75+
docker.acn.fr/openspp/openspp:latest
7076
```
7177

7278
## Image Variants
@@ -75,13 +81,13 @@ docker run -d \
7581
- **Base**: Ubuntu 24.04 LTS
7682
- **Size**: ~1.5GB
7783
- **Use case**: Production deployments requiring maximum compatibility
78-
- **Tag**: `openspp/openspp:latest`
84+
- **Tag**: `docker.acn.fr/openspp/openspp:latest`
7985

8086
### Slim Image (Debian Bookworm)
8187
- **Base**: Debian bookworm-slim
8288
- **Size**: ~1.0GB
8389
- **Use case**: Resource-constrained environments
84-
- **Tag**: `openspp/openspp:latest-slim`
90+
- **Tag**: `docker.acn.fr/openspp/openspp:latest-slim`
8591

8692
## Configuration
8793

@@ -189,17 +195,36 @@ See [kubernetes/](./kubernetes/) directory for Helm charts and manifests.
189195

190196
```bash
191197
# Build standard image (installs from APT repository)
192-
docker build -t openspp:local .
198+
make build
193199

194200
# Build slim image (installs from APT repository)
195-
docker build -f Dockerfile.slim -t openspp:local-slim .
201+
make build-slim
202+
203+
# Build both images
204+
make build-all
196205

197206
# Build for multiple architectures
198207
docker buildx build --platform linux/amd64,linux/arm64 -t openspp:local .
199208
```
200209

201210
Note: The images automatically install the latest daily build from the OpenSPP APT repository at https://builds.acn.fr/repository/apt-openspp-daily/
202211

212+
### Pushing to Nexus Registry
213+
214+
```bash
215+
# Login to Nexus registry
216+
make login
217+
# Or manually:
218+
docker login docker-push.acn.fr
219+
220+
# Push images
221+
make push
222+
```
223+
224+
Images will be available at:
225+
- `docker.acn.fr/openspp/openspp:latest` (public access)
226+
- `docker.acn.fr/openspp/openspp:latest-slim` (public access)
227+
203228
### CI/CD Pipeline
204229

205230
The Woodpecker CI pipeline automatically:

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ services:
8484

8585
# OpenSPP Application (Using slim image for production)
8686
openspp:
87-
image: ${REGISTRY:-docker.io}/openspp/openspp:${IMAGE_TAG:-daily}-slim
87+
image: ${REGISTRY:-docker.acn.fr}/openspp/openspp:${IMAGE_TAG:-daily}-slim
8888
container_name: openspp_app_prod
8989
restart: always
9090
depends_on:

0 commit comments

Comments
 (0)