From 61a6be888c6bc1d6fc8df19ff0c89a524615e4d5 Mon Sep 17 00:00:00 2001 From: Kelly Date: Mon, 15 Dec 2025 20:01:11 -0700 Subject: [PATCH] ci: Consolidate back to 4 docker steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove separate build steps (didn't save time) - Use original multi-stage Dockerfiles - Delete unused Dockerfile.ci files - 4 parallel docker builds + deploy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .woodpecker.yml | 84 ++++++------------------------- backend/Dockerfile.ci | 43 ---------------- cannaiq/Dockerfile.ci | 25 --------- findadispo/frontend/Dockerfile.ci | 25 --------- findagram/frontend/Dockerfile.ci | 25 --------- 5 files changed, 14 insertions(+), 188 deletions(-) delete mode 100644 backend/Dockerfile.ci delete mode 100644 cannaiq/Dockerfile.ci delete mode 100644 findadispo/frontend/Dockerfile.ci delete mode 100644 findagram/frontend/Dockerfile.ci diff --git a/.woodpecker.yml b/.woodpecker.yml index 86df38b7..bc0473d6 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -68,66 +68,14 @@ steps: event: pull_request # =========================================== - # BUILD: Frontend assets in CI (not Docker) - # =========================================== - build-cannaiq: - image: node:22 - commands: - - cd cannaiq - - npm ci --prefer-offline - - npm run build - - ls -la dist/ - depends_on: [] - when: - branch: [master, develop] - event: push - - build-findadispo: - image: node:22 - commands: - - cd findadispo/frontend - - npm ci --prefer-offline - - npm run build - - ls -la build/ - depends_on: [] - when: - branch: [master, develop] - event: push - - build-findagram: - image: node:22 - commands: - - cd findagram/frontend - - npm ci --prefer-offline - - npm run build - - ls -la build/ - depends_on: [] - when: - branch: [master, develop] - event: push - - build-backend: - image: node:22 - commands: - - cd backend - - npm ci --prefer-offline - - npm run build - - npm prune --production - - ls -la dist/ - depends_on: [] - when: - branch: [master, develop] - event: push - - # =========================================== - # DOCKER: Simple copy builds (no npm inside) + # DOCKER: Multi-stage builds (npm + build inside) # =========================================== docker-backend: image: gcr.io/kaniko-project/executor:debug commands: - /kaniko/executor - --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq - --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile.ci + --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend + --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile --destination=10.100.9.70:5000/cannaiq/backend:latest --destination=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} --build-arg=APP_BUILD_VERSION=sha-${CI_COMMIT_SHA:0:8} @@ -137,8 +85,7 @@ steps: --insecure-registry=10.100.9.70:5000 --cache=true --cache-ttl=168h - depends_on: - - build-backend + depends_on: [] when: branch: [master, develop] event: push @@ -147,16 +94,15 @@ steps: image: gcr.io/kaniko-project/executor:debug commands: - /kaniko/executor - --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq - --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile.ci + --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq + --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile --destination=10.100.9.70:5000/cannaiq/frontend:latest --destination=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8} --registry-mirror=mirror.gcr.io --insecure-registry=10.100.9.70:5000 --cache=true --cache-ttl=168h - depends_on: - - build-cannaiq + depends_on: [] when: branch: [master, develop] event: push @@ -165,16 +111,15 @@ steps: image: gcr.io/kaniko-project/executor:debug commands: - /kaniko/executor - --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq - --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile.ci + --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend + --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile --destination=10.100.9.70:5000/cannaiq/findadispo:latest --destination=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8} --registry-mirror=mirror.gcr.io --insecure-registry=10.100.9.70:5000 --cache=true --cache-ttl=168h - depends_on: - - build-findadispo + depends_on: [] when: branch: [master, develop] event: push @@ -183,16 +128,15 @@ steps: image: gcr.io/kaniko-project/executor:debug commands: - /kaniko/executor - --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq - --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile.ci + --context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend + --dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile --destination=10.100.9.70:5000/cannaiq/findagram:latest --destination=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8} --registry-mirror=mirror.gcr.io --insecure-registry=10.100.9.70:5000 --cache=true --cache-ttl=168h - depends_on: - - build-findagram + depends_on: [] when: branch: [master, develop] event: push @@ -207,7 +151,7 @@ steps: from_secret: kubeconfig_data commands: - mkdir -p ~/.kube - - echo "$KUBECONFIG_CONTENT" | tr -d '[:space:]' | base64 -d > ~/.kube/config + - echo "$KUBECONFIG_CONTENT" | base64 -d > ~/.kube/config - chmod 600 ~/.kube/config - kubectl set image deployment/scraper scraper=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq - kubectl rollout status deployment/scraper -n cannaiq --timeout=300s diff --git a/backend/Dockerfile.ci b/backend/Dockerfile.ci deleted file mode 100644 index 92c0fcdc..00000000 --- a/backend/Dockerfile.ci +++ /dev/null @@ -1,43 +0,0 @@ -# CI Dockerfile - assets pre-built in CI step -# No npm install or build - just copy and run -FROM node:22-slim - -# Build arguments for version info -ARG APP_BUILD_VERSION=dev -ARG APP_GIT_SHA=unknown -ARG APP_BUILD_TIME=unknown - -ENV APP_BUILD_VERSION=${APP_BUILD_VERSION} -ENV APP_GIT_SHA=${APP_GIT_SHA} -ENV APP_BUILD_TIME=${APP_BUILD_TIME} - -# Install runtime dependencies only (Chromium for Puppeteer) -RUN apt-get update && apt-get install -y \ - curl \ - chromium \ - fonts-liberation \ - libnss3 \ - libxss1 \ - libasound2 \ - libatk-bridge2.0-0 \ - libgtk-3-0 \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* - -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true -ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium - -WORKDIR /app - -# Copy pre-built assets from CI -COPY backend/package*.json ./ -COPY backend/node_modules ./node_modules -COPY backend/dist ./dist -COPY backend/migrations ./migrations -COPY backend/public/downloads ./public/downloads - -RUN mkdir -p /app/public/images/products - -EXPOSE 3010 - -CMD ["node", "dist/index.js"] diff --git a/cannaiq/Dockerfile.ci b/cannaiq/Dockerfile.ci deleted file mode 100644 index 5b4d82e1..00000000 --- a/cannaiq/Dockerfile.ci +++ /dev/null @@ -1,25 +0,0 @@ -# CI Dockerfile - assets pre-built in CI step -FROM nginx:alpine - -# Copy pre-built assets from CI -COPY cannaiq/dist /usr/share/nginx/html - -# SPA routing config -RUN echo 'server { \ - listen 80; \ - server_name _; \ - root /usr/share/nginx/html; \ - index index.html; \ - gzip on; \ - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; \ - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { \ - expires 1y; \ - add_header Cache-Control "public, immutable"; \ - } \ - location / { \ - try_files $uri $uri/ /index.html; \ - } \ -}' > /etc/nginx/conf.d/default.conf - -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] diff --git a/findadispo/frontend/Dockerfile.ci b/findadispo/frontend/Dockerfile.ci deleted file mode 100644 index 5c8cdc5b..00000000 --- a/findadispo/frontend/Dockerfile.ci +++ /dev/null @@ -1,25 +0,0 @@ -# CI Dockerfile - assets pre-built in CI step -FROM nginx:alpine - -# Copy pre-built assets from CI (CRA builds to /build) -COPY findadispo/frontend/build /usr/share/nginx/html - -# SPA routing config -RUN echo 'server { \ - listen 80; \ - server_name _; \ - root /usr/share/nginx/html; \ - index index.html; \ - gzip on; \ - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; \ - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { \ - expires 1y; \ - add_header Cache-Control "public, immutable"; \ - } \ - location / { \ - try_files $uri $uri/ /index.html; \ - } \ -}' > /etc/nginx/conf.d/default.conf - -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] diff --git a/findagram/frontend/Dockerfile.ci b/findagram/frontend/Dockerfile.ci deleted file mode 100644 index 5424711e..00000000 --- a/findagram/frontend/Dockerfile.ci +++ /dev/null @@ -1,25 +0,0 @@ -# CI Dockerfile - assets pre-built in CI step -FROM nginx:alpine - -# Copy pre-built assets from CI (CRA builds to /build) -COPY findagram/frontend/build /usr/share/nginx/html - -# SPA routing config -RUN echo 'server { \ - listen 80; \ - server_name _; \ - root /usr/share/nginx/html; \ - index index.html; \ - gzip on; \ - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; \ - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { \ - expires 1y; \ - add_header Cache-Control "public, immutable"; \ - } \ - location / { \ - try_files $uri $uri/ /index.html; \ - } \ -}' > /etc/nginx/conf.d/default.conf - -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"]